From 5e65dbf2919ba8982a4c81dc25f6002c129e2078 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 16:55:13 -0600 Subject: [PATCH 1/9] Add buildings layer from Asiaq/NunaGIS TODO: better citation? --- qgreenland/config/datasets/asiaq_nunagis.py | 24 ++++++++++++++++++ .../config/layers/Places/__settings__.py | 1 + qgreenland/config/layers/Places/buildings.py | 25 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 qgreenland/config/datasets/asiaq_nunagis.py create mode 100644 qgreenland/config/layers/Places/buildings.py diff --git a/qgreenland/config/datasets/asiaq_nunagis.py b/qgreenland/config/datasets/asiaq_nunagis.py new file mode 100644 index 00000000..8180358d --- /dev/null +++ b/qgreenland/config/datasets/asiaq_nunagis.py @@ -0,0 +1,24 @@ +from qgreenland.config.helpers.assets.ogr_remote import ogr_remote_asset +from qgreenland.models.config.dataset import Dataset + +asiaq_nunagis = Dataset( + id="asiaq_nunagis", + assets=[ + ogr_remote_asset( + asset_id="buildings", + output_file="{output_dir}/fetched.geojson", + url="https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer/82/query/?f=json&where=OBJECTID+is+not+null&outFields=*&orderByFields=OBJECTID+ASC", + ), + ], + metadata={ + "title": "Asiaq Map Portal Techincal Basemap", + "abstract": ( + """The NunaGIS data server provides data for the the Asiaq Map + Portal Technical Basemap, which includes a variety of datasets.""" + ), + "citation": { + "text": ("""NunaGIS (2023). Date accessed: {{date_accessed}}."""), + "url": "https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer", + }, + }, +) diff --git a/qgreenland/config/layers/Places/__settings__.py b/qgreenland/config/layers/Places/__settings__.py index 3a1e8337..1256f2e8 100644 --- a/qgreenland/config/layers/Places/__settings__.py +++ b/qgreenland/config/layers/Places/__settings__.py @@ -4,5 +4,6 @@ order=[ ":populated_places", ":comprehensive_places", + ":buildings", ], ) diff --git a/qgreenland/config/layers/Places/buildings.py b/qgreenland/config/layers/Places/buildings.py new file mode 100644 index 00000000..97aa9927 --- /dev/null +++ b/qgreenland/config/layers/Places/buildings.py @@ -0,0 +1,25 @@ +from qgreenland.config.datasets.asiaq_nunagis import asiaq_nunagis +from qgreenland.config.helpers.steps.ogr2ogr import ogr2ogr +from qgreenland.config.project import project +from qgreenland.models.config.layer import Layer, LayerInput + +buildings = Layer( + id="buildings", + title="Buildings", + style="buildings_shape", + description="""Polygons representing buildings in Greenland. + + The attribute containing building use is called ‘Info’ and is provided in Danish.""", + tags=["places"], + input=LayerInput( + dataset=asiaq_nunagis, + asset=asiaq_nunagis.assets["buildings"], + ), + steps=[ + *ogr2ogr( + input_file="{input_dir}/fetched.geojson", + output_file="{output_dir}/final.gpkg", + boundary_filepath=project.boundaries["data"].filepath, + ), + ], +) From f8374230e361892b8fa9403c62801cac1b038254 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 17:06:37 -0600 Subject: [PATCH 2/9] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91f575ed..af0cd936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ mentioned "Internet-required data/Topographic map of Greenland" WMS layer. - Add new "Internet-required data/Blue Marble shaded relief and Bathymetry (500m)" WMS layer from NASA Global Imagery Browse Services (GIBS) +- Add new "Places/Buildings" layer from Asiaq/NunaGIS. # v3.0.0alpha2 (2023-05-09) From f33f17175bb39874d4dbb0ca7f0742594834c54f Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 17:06:47 -0600 Subject: [PATCH 3/9] update config lockfile --- qgreenland/config/cfg-lock.json | 65 ++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/qgreenland/config/cfg-lock.json b/qgreenland/config/cfg-lock.json index 20160f36..06690d9e 100644 --- a/qgreenland/config/cfg-lock.json +++ b/qgreenland/config/cfg-lock.json @@ -69,6 +69,29 @@ "title": "Circumpolar Arctic Vegetation, Geobotanical, Physiographic Maps, 1982-2003" } }, + "asiaq_nunagis": { + "assets": { + "buildings": { + "args": [ + "ogr2ogr", + "-oo", + "FEATURE_SERVER_PAGING=YES", + "{output_dir}/fetched.geojson", + "\"https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer/82/query/?f=json&where=OBJECTID+is+not+null&outFields=*&orderByFields=OBJECTID+ASC\"" + ], + "id": "buildings" + } + }, + "id": "asiaq_nunagis", + "metadata": { + "abstract": "The NunaGIS data server provides data for the the Asiaq Map\nPortal Technical Basemap, which includes a variety of datasets.", + "citation": { + "text": "NunaGIS (2023). Date accessed: {{date_accessed}}.", + "url": "https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer" + }, + "title": "Asiaq Map Portal Techincal Basemap" + } + }, "asiaq_private_placenames": { "assets": { "only": { @@ -3460,6 +3483,45 @@ "title": "Place names database" }, "name": "comprehensive_places" + }, + { + "layer_cfg": { + "description": "Polygons representing buildings in Greenland.\n\nThe attribute containing building use is called \u2018Info\u2019 and is provided in Danish.", + "id": "buildings", + "in_package": true, + "input": { + "asset": { + "id": "buildings" + }, + "dataset": { + "id": "asiaq_nunagis" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/greenland_rectangle.geojson", + "-makevalid", + "{output_dir}/final.gpkg", + "{input_dir}/fetched.geojson" + ], + "type": "command" + } + ], + "style": "buildings_shape", + "tags": [ + "places" + ], + "title": "Buildings" + }, + "name": "buildings" } ], "name": "Places", @@ -3467,7 +3529,8 @@ "expand": false, "order": [ ":populated_places", - ":comprehensive_places" + ":comprehensive_places", + ":buildings" ], "show": false } From 47d9a74d6abc53938c59969449618277bc0ca5c5 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 17:15:58 -0600 Subject: [PATCH 4/9] update buildings_shape style update labeling config to use "info" field instead of "name" --- .../ancillary/styles/buildings_shape.qml | 141 ++++++++++++------ 1 file changed, 97 insertions(+), 44 deletions(-) diff --git a/qgreenland/ancillary/styles/buildings_shape.qml b/qgreenland/ancillary/styles/buildings_shape.qml index 26d9b570..0463faf4 100644 --- a/qgreenland/ancillary/styles/buildings_shape.qml +++ b/qgreenland/ancillary/styles/buildings_shape.qml @@ -1,20 +1,29 @@ - - + + - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + 0 0 - 1 2 From 9f6d7e0463aa53f859a827cfd6b08db9eef0bad7 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 18:11:55 -0600 Subject: [PATCH 5/9] Add roads layer from Asiaq/Nunagis TODO: confirm this is the 'correct' roads layer to choose. --- qgreenland/config/datasets/asiaq_nunagis.py | 6 +++++ .../config/layers/Places/__settings__.py | 1 + qgreenland/config/layers/Places/roads.py | 23 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 qgreenland/config/layers/Places/roads.py diff --git a/qgreenland/config/datasets/asiaq_nunagis.py b/qgreenland/config/datasets/asiaq_nunagis.py index 8180358d..9682a529 100644 --- a/qgreenland/config/datasets/asiaq_nunagis.py +++ b/qgreenland/config/datasets/asiaq_nunagis.py @@ -9,6 +9,12 @@ output_file="{output_dir}/fetched.geojson", url="https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer/82/query/?f=json&where=OBJECTID+is+not+null&outFields=*&orderByFields=OBJECTID+ASC", ), + # "VEJMIDTE" means "MIDDLE OF THE ROAD" according to Google Translate + ogr_remote_asset( + asset_id="roads", + output_file="{output_dir}/fetched.geojson", + url="https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer/38/query/?f=json&where=OBJECTID+is+not+null&outFields=*&orderByFields=OBJECTID+ASC", + ), ], metadata={ "title": "Asiaq Map Portal Techincal Basemap", diff --git a/qgreenland/config/layers/Places/__settings__.py b/qgreenland/config/layers/Places/__settings__.py index 1256f2e8..321c3a60 100644 --- a/qgreenland/config/layers/Places/__settings__.py +++ b/qgreenland/config/layers/Places/__settings__.py @@ -5,5 +5,6 @@ ":populated_places", ":comprehensive_places", ":buildings", + ":roads", ], ) diff --git a/qgreenland/config/layers/Places/roads.py b/qgreenland/config/layers/Places/roads.py new file mode 100644 index 00000000..fe60a2e8 --- /dev/null +++ b/qgreenland/config/layers/Places/roads.py @@ -0,0 +1,23 @@ +from qgreenland.config.datasets.asiaq_nunagis import asiaq_nunagis +from qgreenland.config.helpers.steps.ogr2ogr import ogr2ogr +from qgreenland.config.project import project +from qgreenland.models.config.layer import Layer, LayerInput + +roads = Layer( + id="roads", + title="Roads", + # style=None, + description="""Lines representing roads in Greenland.""", + tags=["places"], + input=LayerInput( + dataset=asiaq_nunagis, + asset=asiaq_nunagis.assets["roads"], + ), + steps=[ + *ogr2ogr( + input_file="{input_dir}/fetched.geojson", + output_file="{output_dir}/final.gpkg", + boundary_filepath=project.boundaries["data"].filepath, + ), + ], +) From 789324d37967c256c0227250c36619bb732b88a9 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 18:12:22 -0600 Subject: [PATCH 6/9] update style to use 'Vejnavn` instead of `name` field `Vejnavn` means 'street name' in danish --- qgreenland/ancillary/styles/roads_line.qml | 209 ++++++++++++++------- 1 file changed, 143 insertions(+), 66 deletions(-) diff --git a/qgreenland/ancillary/styles/roads_line.qml b/qgreenland/ancillary/styles/roads_line.qml index 2433351f..91d55352 100644 --- a/qgreenland/ancillary/styles/roads_line.qml +++ b/qgreenland/ancillary/styles/roads_line.qml @@ -1,25 +1,45 @@ - - + + - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + 0 0 - 1 1 From eeeee5a7d34e8a61cfdc17961fa1f6a4c610628c Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Tue, 20 Jun 2023 18:13:12 -0600 Subject: [PATCH 7/9] Update config lockfile --- qgreenland/config/cfg-lock.json | 52 ++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/qgreenland/config/cfg-lock.json b/qgreenland/config/cfg-lock.json index 06690d9e..adadd60b 100644 --- a/qgreenland/config/cfg-lock.json +++ b/qgreenland/config/cfg-lock.json @@ -80,6 +80,16 @@ "\"https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer/82/query/?f=json&where=OBJECTID+is+not+null&outFields=*&orderByFields=OBJECTID+ASC\"" ], "id": "buildings" + }, + "roads": { + "args": [ + "ogr2ogr", + "-oo", + "FEATURE_SERVER_PAGING=YES", + "{output_dir}/fetched.geojson", + "\"https://kort.nunagis.gl/refserver/rest/services/Kortportal/Kortportal_TekniskGrundkort/MapServer/38/query/?f=json&where=OBJECTID+is+not+null&outFields=*&orderByFields=OBJECTID+ASC\"" + ], + "id": "roads" } }, "id": "asiaq_nunagis", @@ -3522,6 +3532,45 @@ "title": "Buildings" }, "name": "buildings" + }, + { + "layer_cfg": { + "description": "Lines representing roads in Greenland.", + "id": "roads", + "in_package": true, + "input": { + "asset": { + "id": "roads" + }, + "dataset": { + "id": "asiaq_nunagis" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/greenland_rectangle.geojson", + "-makevalid", + "{output_dir}/final.gpkg", + "{input_dir}/fetched.geojson" + ], + "type": "command" + } + ], + "style": null, + "tags": [ + "places" + ], + "title": "Roads" + }, + "name": "roads" } ], "name": "Places", @@ -3530,7 +3579,8 @@ "order": [ ":populated_places", ":comprehensive_places", - ":buildings" + ":buildings", + ":roads" ], "show": false } From 7be30572658bb90054401da2523b5fe5926b15b5 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Wed, 21 Jun 2023 08:24:42 -0600 Subject: [PATCH 8/9] Update CHANGELOG --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af0cd936..1fc2f33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,9 @@ mentioned "Internet-required data/Topographic map of Greenland" WMS layer. - Add new "Internet-required data/Blue Marble shaded relief and Bathymetry (500m)" WMS layer from NASA Global Imagery Browse Services (GIBS) -- Add new "Places/Buildings" layer from Asiaq/NunaGIS. +- Add new "Places/" layers from Asiaq/NunaGIS: + - Buildings + - Roads # v3.0.0alpha2 (2023-05-09) From 61a942ca837db0d440eaecf2b444cfa1e00095a7 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Wed, 21 Jun 2023 10:21:08 -0600 Subject: [PATCH 9/9] update style for roads layer --- qgreenland/config/cfg-lock.json | 2 +- qgreenland/config/layers/Places/roads.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qgreenland/config/cfg-lock.json b/qgreenland/config/cfg-lock.json index adadd60b..e0331362 100644 --- a/qgreenland/config/cfg-lock.json +++ b/qgreenland/config/cfg-lock.json @@ -3564,7 +3564,7 @@ "type": "command" } ], - "style": null, + "style": "roads_line", "tags": [ "places" ], diff --git a/qgreenland/config/layers/Places/roads.py b/qgreenland/config/layers/Places/roads.py index fe60a2e8..f4b57805 100644 --- a/qgreenland/config/layers/Places/roads.py +++ b/qgreenland/config/layers/Places/roads.py @@ -6,7 +6,7 @@ roads = Layer( id="roads", title="Roads", - # style=None, + style="roads_line", description="""Lines representing roads in Greenland.""", tags=["places"], input=LayerInput(