DE talk:HowTo minutely hstore

From OpenStreetMap Wiki
Jump to navigation Jump to 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.

update.sh:

#!/bin/sh
A=$1
T=$2
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');"

und:

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

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

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

Deletion

@Nakaner:

"The user only requested deletion of the German translation but neither the English nor the Italian pages. Was that intended? Before the deletion request, the page looked similar to the other versions. There are many incoming links, some should be fixed." (written by User:Tigerfell)

(copied from https://wiki.openstreetmap.org/w/index.php?title=Talk:Wiki&curid=1907&diff=2285675&oldid=2284720 )

Mateusz Konieczny (talk) 21:43, 12 March 2022 (UTC)