Skip to content

[EMS] Update Norway counties #565

@jsanz

Description

@jsanz

EMS has outdated counties for Norway that require a new version to be published. The current source SPARQL query works with Sophox (no need for a UNION anymore) and provides an updated list covering the country

#defaultView:MapRegions
SELECT
(if(bound(?id2),?id2,?id1) as ?id)
?iso_3166_2 ?label_en ?label_nn ?label_nb
WHERE {
  SERVICE <https://query.wikidata.org/sparql> {
  # Using nested query to ensure there is only one ?id2 value
  {SELECT
  ?id1
  (SAMPLE(?id2) as ?id2)
  (SAMPLE(?iso_3166_2) as ?iso_3166_2)
  (SAMPLE(?label_en) as ?label_en)
  (SAMPLE(?label_nn) as ?label_nn)
  (SAMPLE(?label_nb) as ?label_nb)
  WHERE {{
    # List of regions, whose sub-regions we want.
    VALUES ?entity { wd:Q20 }

    # P150 = "contains administrative territorial entity"
    ?entity wdt:P150 ?id1 .
    ?id1 wdt:P300 ?iso_3166_2

    OPTIONAL { ?id1 rdfs:label ?label_en . FILTER(LANG(?label_en) = "en") }
    OPTIONAL { ?id1 rdfs:label ?label_nn . FILTER(LANG(?label_nn) = "nn") }
    OPTIONAL { ?id1 rdfs:label ?label_nb . FILTER(LANG(?label_nb) = "nb") }
  }}
  # remove possible ID duplicates
  GROUP BY ?id1}
}
}

But this needs further investigation because the table from Wikidata/Sophox returns the following (simplified) table

iso_3166_2 label_en
NO-03 Oslo
NO-11 Rogaland
NO-15 Møre og Romsdal
NO-18 Nordland
NO-21 Svalbard
NO-22 Jan Mayen
NO-31 Østfold
NO-32 Akershus
NO-33 Buskerud
NO-34 Innlandet
NO-39 Vestfold
NO-40 Telemark
NO-42 Agder
NO-46 Vestland
NO-50 Trøndelag
NO-55 Troms
NO-56 Finnmark

While the ISO website returns

code name
NO-03 Oslo
NO-11 Rogaland
NO-15 Møre og Romsdal
NO-18 Nordland
NO-21 Svalbard
NO-22 Jan Mayen
NO-30 Viken
NO-34 Innlandet
NO-38 Vestfold og Telemark
NO-42 Agder
NO-46 Vestland
NO-50 Trøndelag
NO-54 Troms og Finnmark

Being the differences:

This shows that Wikidata provides the latest ISO codes, but they are not yet approved in the ISO website.

Given that codes are not overwritten, only replaced, it would be possible to keep all codes, having then overlapping geometries, but ensuring clients with different datasets referring to different points in time for this dataset still find their geometries. In any case this needs review to ensure it does not break anything.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions