OSM database contains WikidataID in the tag->'wikidata' hstore column. The simplest solution seems to add this conditional index:
CREATE INDEX planet_osm_polygon_wikidata ON planet_osm_polygon ((tags -> 'wikidata')) WHERE tags ? 'wikidata';
OSM database contains WikidataID in the tag->'wikidata' hstore column. The simplest solution seems to add this conditional index:
CREATE INDEX planet_osm_polygon_wikidata ON planet_osm_polygon ((tags -> 'wikidata')) WHERE tags ? 'wikidata';
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) | |||
Open | None | 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 | T134085 Implement quick shape retrieval from Postgres based on WikidataID | |||
Resolved | Gehel | T112423 Update osm2pgsql to 0.90+ |
Per @Pnorman, we are using this default style with osm2pgsql, which we should alter to add the wikidataid. See also our current install script
I am experimenting with the maps-test2001:
CREATE INDEX planet_osm_polygon_wikidata ON planet_osm_polygon ((tags -> 'wikidata')) WHERE tags ? 'wikidata';
Querying all readable columns from the polygon table using the new wikidata id index (above).
Note that we check that tags contains 'wikidata' key AND it is equal to our value. Without this, our index is not being used, and it does full table scan instead.
SELECT osm_id,access,"addr:housename","addr:housenumber","addr:interpolation",admin_level,aerialway,aeroway,amenity,area,barrier,bicycle,brand,bridge,boundary,building,construction,covered,culvert,cutting,denomination,disused,embankment,foot,"generator:source",harbour,highway,historic,horse,intermittent,junction,landuse,layer,leisure,lock,man_made,military,motorcar,name,"natural",office,oneway,operator,place,population,power,power_source,public_transport,railway,ref,religion,route,service,shop,sport,surface,toll,tourism,"tower:type",tracktype,tunnel,water,waterway,wetland,width,wood,z_order,way_area, tags FROM planet_osm_polygon WHERE tags ? 'wikidata' and tags->'wikidata' = 'Q1166';
I found the following columns interesting: admin_level, boundary, name, ref, z_order, way_area. I wonder if we could use the way_area to figure out the best way simplification? Reading relevant literature.
Some interesting results searching for (tags->'wikidata' IN ('Q1166', 'Q16', 'Q30', 'Q46', 'Q2', 'Q98')) (Michigan, Canada, USA, Europe, Earth, Pacific Ocean): found 1 Michigan, 3 Canadas, and about 55 USAs. No other items were given (I was hoping for Europe)
This service is now implemented and can be enabled as part of Maps (Kartotherian) by adding this config block as described in the README:
Make sure to create OSM index as specified in the description above
geoshapes: host: localhost database: gis table: planet_osm_polygon user: ... password: ...
TODO: decide on what simplification formula to use