aboutsummaryrefslogtreecommitdiffstats
path: root/export_mvt.py
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)
* MVT: Generate metadata.json with copyright and timing information.Guilhem Moulin10 days1
| | | | So the information can be exposed to the webmap's info dialog.
* webmap-import: Remove option --mvtdir-tmp.Guilhem Moulin2025-05-211
| | | | | | | | | | | | | | | | | | | | | | Having a shared temporary directory, flock(2)'ed to avoid races, is a great idea in theory but unfortunately doesn't work so well with systemd.exec(5)'s ReadWritePaths settings since ReadWritePaths=/var/www/webmap/tiles ReadWritePaths=/var/www/webmap/tiles.tmp creates multiple mount points pointing at the same file system and rename(2)/renameat2(2) can't cope with that. Quoting the manual: EXDEV oldpath and newpath are not on the same mounted filesystem. (Linux permits a filesystem to be mounted at multiple points, but rename() does not work across different mount points, even if the same filesystem is mounted on both.) So the options are to either use a single ReadWritePaths=/var/www/webmap, or --mvtdir-tmp=/var/www/webmap/tiles/.tmp. Both kind of defeat the point (we'd in fact want to use --mvtdir-tmp=/var/tmp/webmap/tiles), so we use mkdtemp(3) instead.
* MVT: Don't clip features manually.Guilhem Moulin2025-05-211
| | | | | | | | | | | | | | | | | | | | | | It's done automatically by the MVT driver. Also we don't want to clip at the extent boundaries, but instead leave som headroom so the clipped polygon border is not visible on the map. The MVT driver does that. It seems that GDAL 3.6.2 from Debian Bookworm generates too many tiles though. It yields the following tile counts for group ‘ren’: no manual clipping, BUFFER=32: 83718 tiles [min=33 B, max=117.70 kiB, sum=15.73 MiB, avg=197 B] no manual clipping, BUFFER=0: 83676 tiles clip at extent, BUFFER=32: 76256 tiles GDAL 3.10.3 from Debian Trixie yields less surprising tile counts: no manual clipping, BUFFER=32: 75972 tiles [min=33 B, max=128.16 kiB, sum=15.10 MiB, avg=208 B] no manual clipping, BUFFER=0: 75939 tiles clip at extent, BUFFER=32: 75972 tiles (Interesting to see that the largest tile — 0/0/0.pbf — is over 10kiB larger with the more recent GDAL version, also.)
* webmap-import: Add option to generate Mapbox Vector Tiles (MVT).Guilhem Moulin2025-05-211