aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-download-mrr.py
Commit message (Collapse)AuthorAgeFiles
* Update Mineralrättigheter import logic.Guilhem Moulin2025-04-281
| | | | | | | | | | | | | | | | | | | | Thanks to EU Directive 2019/1024 of the European Parliament and of the Council of 20 June 2019 on open data and the re-use of public sector information, and the Commission Implementing Regulation (EU) 2023/138 of 21 December 2022, the mineral register is now available under the terms of the CC0 1.0 Universal licence, see https://www.sgu.se/produkter-och-tjanster/geologiska-data/malmer-och-mineral--geologiska-data/mineralrattigheter-och-prospektering/ Given we no longer need to parse SVG images from the webmap, we drop webmap-download-mrr.py and add layers for expired and forbidden permits (ut_metaller_industrimineral_forfallna, ut_olja_gas_diamant_forfallna, bearbetningskoncessioner_forfallna, ut_metaller_industrimineral_forbud, ut_diamant_forbud) as well as markanvisningar_bk_ansokta. Unfortunately the GeoPackage file doesn't include peat concessions, so we drop them from config.yml for now. Should they be of interest we can always restore webmap-download-mrr.py and/or order the register from Bergsstaten, cf. https://resource.sgu.se/bergsstaten/exporter-ur-mrr-info.pdf .
* Add type hints and refactor a bit to please pylint.Guilhem Moulin2025-04-191
|
* MRR: Relax triangulation() to avoid failing in some degenerate cases.Guilhem Moulin2024-09-191
| | | | | | | | | | | In some degenerate cases DelaunayTriangulation() returns a GEOMETRYCOLLECTION where no triangle is fully contained in the input geometry, which causes getRandomPoint() to fail as the list of cumulative weights is an empty list. We “overshoot” in that case and return the non-curated triangulation. getRandomPoint(…, max_tries=1024) should be enough to eventually hit a point in the input geometry.
* webmap-download*: Use narrow non-breaking space (U+202F) as unit separator.Guilhem Moulin2024-06-081
|
* webmap-download*: Use +=.Guilhem Moulin2024-06-081
|
* webmap-download-mrr: Don't print request count on empty layers.Guilhem Moulin2024-06-051
| | | | | We always exit after a single WMS request if the layer has no SVG paths. Don't print the request count in that case.
* webmap-download-mrr: Don't print request count when skipping the layer.Guilhem Moulin2024-06-041
|
* webmap-download-mrr: Minor refactoring.Guilhem Moulin2024-06-041
|
* webmap-download-mrr: Don't bother sorting the feature list.Guilhem Moulin2024-06-031
|
* webmap-download-mrr.py: Show number of WMS requests on exit.Guilhem Moulin2024-06-031
| | | | (Incl. failure.)
* Add layer definitions for Mineralrättigheter.Guilhem Moulin2024-06-031
Unfortunately SGU/Bergsstaten doesn't offer layer files to download, but it has an online webmap (WMS) at https://apps.sgu.se/kartvisare/kartvisare-mineralrattigheter.html so we add a dedicated module to probe and fetch features from it. Double checked that the resulting combination of GeoJSON files does not result in data loss compared to the previous (private) script: sort_features() { jq -S '.features |= sort_by(.properties.Name, .properties.Layer, .properties.Area)' } diff -u --color=auto \ <(ogr2ogr -f GeoJSON -lco COORDINATE_PRECISION=2 /vsistdout/ $dir/Mineralrättigheter.gpkg \ SE.GOV.SGU.MRR.BEARBETNINGSKONCESSIONER_APPLIED_VY | jq '.name = "MRR:" + .name' | sort_features) \ <(ogr2ogr -f GeoJSON -lco COORDINATE_PRECISION=2 -nlt MULTIPOLYGON -nlt PROMOTE_TO_MULTI \ /vsistdout/ mrr/bearbetningskoncessioner_applied.geojson | sort_features) (and similar for other layers).