aboutsummaryrefslogtreecommitdiffstats
path: root/config.yml
Commit message (Collapse)AuthorAgeFiles
* Export feature "age" to MVT.Guilhem Moulin5 days1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows client-side filtering. The "age" attribute is a signed short (int16) expressing the number of days since 1970-01-01. This covers the range 1880-04-15 to 2059-09-18 which should be more than enough. The source value is a Date or Datetime and depends on the source layer. - For vbk:*, it's the date at which the project was last saved in Vindbrukskollen. - For mrr:*, it's the date at which the application came to Bergsstaten for applications, and decision date for granted permits. - For avverk:*, it's the date at which the application came to Skogsstyrelsen for applications, and the clearcut date (according to Skogsstyrelsen) for completed objects. For other layers, we don't export that attribute. This makes the tiles a bit larger. Before (without the extra attribute): vbk: 1261× tiles, 599kiB uncompressed (avg=487B/t), 389kiB brotli (35%, avg=316B/t) avverk: 3734× tiles 115MiB uncompressed (avg=32kiB/t), 72MiB brotli (37%, avg=20kiB/t) mrr: 1324× 331kiB uncompressed (avg=257kiB/t), 289kiB brotli (13%, avg=223B/t) → total 121631367B uncompressed (avg=19kiB/t), 76692807B brotli (37%, avg=12kiB/t) After (with the extra attribute): vbk: 1261× tiles, 714kiB uncompressed (avg=580B/t), 425kiB brotli (40%, avg=345B/t) avverk: 3734× tiles 127MiB uncompressed (avg=35kiB/t), 78MiB brotli (39%, avg=21kiB/t) mrr: 1324× 323kiB uncompressed (avg=322kiB/t), 342kiB brotli (18%, avg=265B/t) → total 134274796B uncompressed (avg=21kiB/t), 82264731B brotli (39%, avg=13kiB/t) Summary: +12.1MiB uncompressed (+10.4%, avg=+1.95kiB/t) +5.3MiB compressed (+7.3%, avg=+882B/t)
* Drop OBJECTID from layer `lst:pagaende_naturreservatsbildning` as it is not ↵Guilhem Moulin6 days1
| | | | a stable attribute.
* Rename cache prefix from ren/ to sametinget/.Guilhem Moulin6 days1
|
* Add comment.Guilhem Moulin7 days1
|
* typofixGuilhem Moulin7 days1
|
* Rename “ren:*” tables to “sametinget:*”.Guilhem Moulin7 days1
|
* Rename “ri:*” tables to “nvk:riksintresse_*” and ↵Guilhem Moulin7 days1
| | | | “lst:riksintresse_*”.
* Rename “sks” group to “avverk”.Guilhem Moulin7 days1
| | | | | And “sks:AvverkAnm” resp. “sks:UtfordAvverk” to “sks:avverk_anmald” resp. “sks:avverk_utford”.
* Rename “nvr” group to “skydd” and drop “nva:” prefix.Guilhem Moulin7 days1
| | | | | It's clearer that way, after all Naturvårdsavtal and Återvätningsavtal are not part of Naturvårdsverkets Naturvårdsregistret.
* Add various nature value layers.Guilhem Moulin7 days1
| | | | | Including k-skog, but we leave that one alone for now as the script lacks some logic to process raster files.
* typofixGuilhem Moulin8 days1
|
* VBK: Split offshore wind farms layers when exporting to MVT.Guilhem Moulin9 days1
| | | | Inspired from https://vbk.lansstyrelsen.se/ .
* VBK: Improve description.Guilhem Moulin10 days1
|
* VBK: Fix schema for source layer LST.vbk_projekteringsomraden and ↵Guilhem Moulin10 days1
| | | | | | | | | | | LST.vbk_havsbaserad_vindkraft. It appears these source file are exported daily at 01:53, then again at 07:41 but different content and schema…. We're now targeting the latter. This reverts commit 59a0ebbb824eaa75dcf7b0e39c5b627fb5ace294 and partially reverts commit 2d8f839914feb2b9d31f2682b1c9992dd21c9b16.
* MRR: Drop field export_date.Guilhem Moulin10 days1
| | | | | | | All features have the same export date value, so the date is arguably a schema attribute not a feature attribute. Since exports from the mineral register happens daily nowdays the date should never be more than a day off compared with the zip file's mtime.
* VBK: Fix schema for source layer LST.vbk_projekteringsomraden.Guilhem Moulin10 days1
|
* VBK: Use the shapefile as source for offshore projects.Guilhem Moulin10 days1
| | | | | | | | | | | | | | | | | The file appears to be official and updated as often as the GPKG nowdays. Both have 101 distinct features. And unlike the GPKG the multipolygons are not split, so we add the UNIQUE CONSTRAINT on "OmrID". For some reason there are a lot of duplicates in the GPKG. sqlite> SELECT "ObjectID", COUNT(*) FROM "lst_vbk_havsbaserad_vindkraft" GROUP BY 1 ORDER BY 2; 101|9 1|24 2|24 […] 100|24
* MVT: Generate metadata.json with copyright and timing information.Guilhem Moulin10 days1
| | | | So the information can be exposed to the webmap's info dialog.
* Drop unused MVT layer mrr:appl_dl.Guilhem Moulin2025-05-261
|
* MVT: Lower max-zoom to 7 (8m/px) from 9 (2m/px).Guilhem Moulin2025-05-211
| | | | | | | | | | | | | | | | | The webmap currently doesn't go beyond zoom level 7 (8m/px) so it makes little sense to create tiles for higher zoom levels. It speeds things up and saves CPU resources and disk space, too. For group ‘ren’ on the desktop (GPKG destination dataset), before (max-zoom=9): INFO: Exported 4488 features to 4 MVT layers in 00:06:02.926 INFO: Tile count: 75972 [min=33 B, max=128.16 kiB, sum=15.10 MiB, avg=208 B] vs. after (max-zoom=7): INFO: Exported 4488 features to 4 MVT layers in 00:00:25.548 INFO: Tile count: 5031 [min=35 B, max=128.16 kiB, sum=4.80 MiB, avg=0.98 kiB]
* webmap-import: Add option to generate Mapbox Vector Tiles (MVT).Guilhem Moulin2025-05-211
|
* config.yml: Record sks:AvverkAnm columns following order from the source layer.Guilhem Moulin2025-04-281
|
* 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 .
* Change layer cache logic to target destination layers rather than sources.Guilhem Moulin2025-04-241
| | | | | | | | | | | | | | | | | | | | In a future commit we'll fingerprint layers to detect changes. Comparing modification times is not enough since some sources (for instance Naturvårdsverket's SCI_Rikstackande) are updated on the server even though no objects are being added; the source layer remains unchanged but the file differs because of OBJECTID changes we are not interested in. Rather than using another cache layer/table for fingerprints, we cache destination layernames rather than triplets (source_path, archive_member, layername), along with the time at which the import was started rather than source_path's mtime. There is indeed no value in having exact source_path's mtime in the cache. What we need is simply a way to detect whether source paths have been updated in a subsequent run. Thanks to the shared locks the ctime of any updated source path will be at least the time when the locks are released, thereby exceeding the last_updated value.
* Skogsstyrelsen: Relax some constraints on the schema to reflect current GPKG ↵Guilhem Moulin2025-04-231
| | | | files.
* webmap-import: Add a cache layer and store the source file's last ↵Guilhem Moulin2025-04-231
| | | | | | | | | | | | | | | | | | | | | | | | modification time. That way we can avoid the expensive unpack+import when the source file(s) have not been updated since the last run. The check can be bypassed with a new flag `--force`. We use a sequence for the FID:s (primary key) and a UNIQUE constraint on triplets (source_path, archive_member, layername) as GDAL doesn't support multicolumns primary keys. To avoid races between the stat(2) calls, gdal.OpenEx() and updates via `webmap-download` runs we place a shared lock on the downloaded files. One could resort to some tricks to eliminate the race between the first two, but there is also some value in having consistency during the entire execution of the script (a single source file can be used by multiple layers for instance, and it makes sense to use the very same file for all layers in that case). We also intersperse dso.FlushCache() calls between _importSource() calls in order to force the PG driver to call EndCopy() to detect errors and trigger a rollback when _importSource() fails.
* Factor sources in config.yml.Guilhem Moulin2025-04-191
| | | | | | | | | This avoid duplications when the same source file is used multiple times (either by the same layer or by multiple layers). This change breaks webmap-import, but that one will be refactored shortly. It also breaks webmap-import-mrr.py, which is no longer used since mineralrattigheter.zip can be downloaded from SGU's site directly.
* mrr:markanvisningar: Make DecisionDate non-nullable.Guilhem Moulin2025-03-171
| | | | It appears it is no longer stripped in Bergsstaten's mineralregister.
* Relax some UNIQUE constraint on the MRR layer's DiaryNR column.Guilhem Moulin2024-10-291
| | | | | | | Apparently there are duplicates for dnr BS 22-28-2000 (bearbetningskoncessioner_beviljade) and BS 23-126-2007, BS 23-116-2005, BS 23-226-1930, BS 23-149-1960, BS 23-7-2000, and BS 23-105-2010 (markanvisningar_bk_beviljade).
* Bump User-Agent value to Tor Browser 14.Guilhem Moulin2024-10-271
|
* nva:Skogsstyrelsen: Remove NOT NULL constraint on the DatAvtal column.Guilhem Moulin2024-10-271
| | | | | | As of today SK 117-2024 has not contract date set, so the constraint fails during import. https://www.skogsstyrelsen.se/skogens-parlor/NVAvtal/?objektid=4020527
* Add comments and value substitution to some Riksintresse layers.Guilhem Moulin2024-10-201
|
* Add layer with noteworthy dams.Guilhem Moulin2024-10-191
| | | | | | | | Unfortunately the dam register is way too noisy Unfortunately it looks like there is no way to download a pre-curated dam registry with only noteworthy dams used for production (SvK's dammar_pf.shp comes close but still misses some), so we manually remove the ones which are more than 2km from a production site or a power station.
* Add layer with planed gigafactories.Guilhem Moulin2024-10-191
| | | | Own work.
* Add layers from Svenska Kraftnät (SvK).Guilhem Moulin2024-10-191
|
* Add comments to some SKS layers fields.Guilhem Moulin2024-10-191
|
* nvr:Naturminne_punkt: Only publish at zoom level ≥4.Guilhem Moulin2024-10-191
|
* typofixGuilhem Moulin2024-10-191
|
* Add layers for Naturvårdsverkets and Länsstyrelserns Riksintressen.Guilhem Moulin2024-10-181
| | | | | | | Cf. https://skyddadnatur.naturvardsverket.se/ . We exclude Nationalstadspark (MB 4 kap 7§) since the only entry is in Stockholm (Kungliga nationalstadsparken, Ulriksdal-Haga-Brunnsviken-Djurgården) outside our extent.
* Use `nvk/nr` as cache directory for downloaded layers from Naturvårdsregistret.Guilhem Moulin2024-10-181
|
* Add layers for Naturvårdsregistret and Naturvårdsavtal.Guilhem Moulin2024-10-171
|
* Fix publication layer name for MRR.Guilhem Moulin2024-09-261
|
* typofixGuilhem Moulin2024-09-261
|
* Ignore field ‘OBJECTID’ on the layers from Sametinget.Guilhem Moulin2024-09-261
| | | | Looks like a FID sequence, so not really useful for us…
* Add layer data for Rennäringen.Guilhem Moulin2024-09-261
| | | | From Sametinget via Länsstyrelsen.
* Add `webmap-publish` script to export layers to Mapbox Vector Tiles.Guilhem Moulin2024-09-251
|
* Adjust VBK's mapping schema to the files currently provided.Guilhem Moulin2024-09-201
|
* Skogsstyrelsen: Fetch Shapefiles rather than GeoPackage files.Guilhem Moulin2024-09-191
| | | | | | | | | | | | | | | | | The former have been deprecated per following note on https://www.skogsstyrelsen.se/sjalvservice/karttjanster/geodatatjanster/nerladdning-av-geodata/ Påminnelse om vektordata ------------------------ Från och med 1 mars finns vektordata i GeoPackage-format. Shape-filerna tas bort 16 september. För de flesta datamängder kommer vi att ta bort de länsvisa lagren och bara ha rikstäckande lager. These GeoPackage layers have geometry type POLYGON but appear to contain MULTIPOLYGONs as well, so fortunately there is no data loss due to geometry splitting.
* Add layer definitions for Vindbrukskollen layers.Guilhem Moulin2024-06-221
| | | | | | | | | | | | | | | | | Only the land-based ones for now. Source: https://www.energimyndigheten.se/energisystem-och-analys/elproduktion/vindkraft/vindbrukskollen/ Layers: - https://ext-geodatakatalog.lansstyrelsen.se/GeodataKatalogen/srv/api/records/GetMetaDataById?id=ed5814b2-08bf-493a-a164-7819e1b590d6 LST Vindbrukskollen landbaserade vindkraftverk - https://ext-geodatakatalog.lansstyrelsen.se/GeodataKatalogen/srv/api/records/GetMetaDataById?id=c816bd1e-bc6c-487f-a962-770f05f677b6 LST Vindbrukskollen landbaserade projekteringsområden - https://ext-geodatakatalog.lansstyrelsen.se/GeodataKatalogen/srv/api/records/GetMetaDataById?id=c290bc31-1af8-497e-a9a5-87fcec55d0ce LST Vindbrukskollen havsbaserad vindkraft Webmaps: - https://vbk.lansstyrelsen.se/ - https://ext-geodatakatalog.lansstyrelsen.se/GeodataKatalogen/srv/swe/catalog.search#/map
* Conditionally use GetTZFlag()/SetTZFlag() depending on the GDAL version.Guilhem Moulin2024-06-201
| | | | | | | | | OGRFieldDefn: add GetComment() / SetComment() methods were added in OGR 3.8.0, cf. https://github.com/OSGeo/gdal/blob/master/NEWS.md#core-3 . Don't comment out TZ on field definitions. Instead we check the GDAL/OGR version and ignore TZ on field definitions if the OGR version is too old.