[OSM-talk] OSM maps on Garmin GPS

Lars Aronsson lars at aronsson.se
Thu Nov 23 23:29:16 GMT 2006


Mikel Maron wrote:

> The essential speed up, as far as I understand, is that mapnik 
> processes planet.osm and inserts the complete geometry of each 
> element into a single row, with selected tags as columns. This 
> is in contrast to the main editing database which requires an 
> intensive join to get geometries and tags.

I have suspected that a solution lies in this direction, but I 
have made no experiments.  It would be interesting to see the 
behaviour of the old tile generator from, say, June 2006, with 
this modification.

In my very primitive Gnuplot hack, this "denormalization" is the 
first step, here implemented in shell script magic from 
http://wiki.openstreetmap.org/index.php/Print_OpenStreetMap_with_Gnuplot


 #!/bin/sh
 
 <planet.osm tr \' \" |
 sed '/<node/!d;s/.*id="\([0-9]*\)" lat="\([-.0-9]*\)" lon="\([-.0-9]*\)".*/\1 \2 \3/' |
 sort -k1,1 >nodes
 
 <planet.osm tr \' \" |
 sed '/<segment/!d;s/.*id="\([0-9]*\)" from="\([0-9]*\)" to="\([0-9]*\)".*/\1 \2 \3/' |
 sort -k3,3 | join -1 3 -2 1 - nodes |
 sort -k3,3 | join -1 3 -2 1 - nodes |
 sort -k3,3 -n |
 awk '{printf "\n# segment %d from %d to %d\n%s %s\n%s %s\n", $3, $1, $2, $7, $6, $5, $4; }' >OpenStreetMap


Isn't it beautiful with the sort-join-sort-join-sort chain?


-- 
  Lars Aronsson (lars at aronsson.se)
  Aronsson Datateknik - http://aronsson.se




More information about the talk mailing list