DE talk:HowTo minutely hstore

From OpenStreetMap Wiki
(Redirected from DE talk:Minutely hstore)
Jump to: navigation, search

Mapnik-Rendering mit PostGIS hstore-Extension

Wenn die Extension "hstore" in der PostGIS-Datenbank aktiviert ist und man mittels osm2pgsql und hstore-Style die OSM-Daten importiert hat, aber trotz hstor-Feature die alten Mapnik-Rendering Styles verwenden will, so kann man mittels Script die fehlenden Spalten in den osm_planet-Tabellen anlegen. Folgendes Script erzeugt für ein gegebenes hstore-Attribut die entsprechende Spalte in der Tabelle.

psql -h localhost -U osm osm -c "alter table planet_osm_$A add column \"$T\" text; update planet_osm_$A set \"$T\" = tags->'$T' where exist(tags, '$T');"


sh polygon amenity
sh polygon landuse
sh polygon leisure
sh polygon man_made
sh polygon military
sh polygon natural
sh polygon power
sh polygon natural
sh polygon tourism
sh polygon highway
sh polygon name
sh polygon wood
sh polygon religion
sh polygon z_order
sh polygon way_area

sh line waterway
sh line disused
sh line lock
sh line name
sh line tunnel
sh line bridge
sh line z_order
sh line man_made
sh point waterway
sh line highway
sh line historic
sh point highway
sh line horse
sh line foot
sh line bicycle
sh line tracktype
sh line barrier
sh line natural
sh polygon barrier
sh polygon railway
sh line service
sh polygon building
sh polygon leisure
sh polygon railway
sh line construction
sh line aeroway
sh line railway
sh line route
sh line aerialway
sh roads highway
sh roads railway
sh roads 
sh roads tunnel
sh roads service
sh roads z_order
sh line layer
sh line access
sh line highway
sh roads admin_level
sh roads boundary
sh point place
sh point name
sh point ref
sh point capital
sh point railway
sh point aerialway
sh point disused
sh polygon aerialway
sh polygon disused
sh point aeroway
sh point barrier
sh point man_made
sh point power
sh point power_source
sh point natural
sh polygon power_source
sh point shop
sh point amenity
sh point tourism
sh point access
sh point religion
sh point lock
sh point histoic
sh point historic
sh point leisure
sh polygon shop
sh polygon access
sh polygon lock
sh polygon historic
sh line power
sh line oneway
sh roads ref
sh line ref
sh line leisure
sh line landuse
sh point landuse
sh point ele
sh point military
sh polygon place
sh polygon ref
sh line interpolation
sh line addr:interpolation
sh line addr:housenumber
sh polygon addr:housenumber
sh point addr:housenumber
sh polygon boundary

Startet man den Mapnik-Renderer manuell über "sudo su tirex", "tirex-rendering-manager -d", so kann man auf der Console eventuelle Fehlermeldungen verfolgen.

Use render_expired instead of tile_exipry/expire.rb

The tile_exipry/expire.rb script is looks quite inefficient - it seems that it re-parses .osc and/or queries database to build list of changed tiles, this takes many minutes for 6-hours planet diffs. In the same time osm2pgsql can generate list of expired tiles with at no extra cost (with parameters -e and -o), while doing real import. I modified load-next as following to use osm2pgsql list and render_expired (which you also probably already have with mod_tile), so tile_expiry is not needed anymore and tile expiration takes <30 sec for 6-hour planet diffs.

if ! $OSM2PGSQL --append --slim -e15 -o expire.list --number-processes=4 --cache 2048 --merc --database $DB --username $USER -P $PORT --hstore --verbose "$CURRENT" 1>&2 2> "$PSQLLOG"; then

if ! sudo -u www-data cat expire.list | /usr/bin/render_expired  -s /var/run/renderd/renderd.sock --map=default --min-zoom=10 --touch-from=10 2>&1 > "$EXPIRYLOG"; then
 m_error "tile_expiry error"

--Jaakl 10:43, 23 December 2011 (UTC)