A great article https://blog.cartodb.com/smaller-faster/ might be a good start for PostGIS-based optimization (thx @Pnorman for suggesting)
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | • JGirault | T132971 Implement Kartographer customization to match Wikivoyage existing map | |||
Declined | Yurik | T137364 Migrate {{geo}} Wikivoyage template to <maplink> (with an icon) | |||
Resolved | TheDJ | T137656 Migrate WV Template:PoiMap2detail to new maplink | |||
Resolved | Yurik | T134086 Allow map tags to get geodata from Kartotherian | |||
Resolved | Yurik | T138192 Implement Graph support of the OSM geo service | |||
Resolved | Yurik | T134084 Provide osm mapdata service | |||
Resolved | Yurik | T138154 Implement shape simplification |
Event Timeline
Moved from T134085#2391825: Simplification notes from @Pnorman (thx!)
don't simplify in 4326, do it in a non-geodetic projection. the appropriate simplification should probably be some factor times something from geometry. maybe st_length, or geometric mean of x and y of bboxes in the collection, maybe something else
try different things out. basing it on just bounding box values avoids needing to do as many calculations. a mercator system would work fine for simplification since the mercator distortion will cancel out
<yurik> Are you saying I should do something like ST_Envelope(ST_Transform(way, mercator)), and get the range between the min/maxes, use the biggest one (X or Y), and then experiment what multiplier I need to get the best tolerance?
maybe st_transform(st_simplify(st_transform(geom,M), N*sqrt(st_area(st_transform(st_envelope(geom),M))), true),st_srid(geom))
or maybe use the biggest one.
I implemented a number of different simplifications (some might not work outright) to try them out. The code is here.
Simplifications can be accessed via parameters, e.g. /shape?q=Q656&sql=simplify&tolerance=100
Closing because we now have this, and to optimize it to better defaults would be a different task.
Can someone please revert or re-implement this so that the simplification is not so aggressive - it starts to prevent Wimimedia Maps from being used for example on English Wikipedia. The maps can not be used for example to show country borders. See relevant discussion at
https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(miscellaneous)&oldid=909413139
in section OpenStreetMap. Multiple people complain about over-simplified features.
The new bug is at T155919
Thanks.