[OSM-dev] Database-manipulation without PostGIS

Frederik Ramm frederik at remote.org
Mon Apr 5 07:43:12 BST 2010


Hi,

Claudius wrote:
> I'd like to help him get a usable Garmin map for Iran without 
> manipulating the base OSM database by copying name:en to name in an Iran 
> excerpt before running it through mkgmap.

Generally, a simple replace could be done with sed on the commandline 
(sed -e "s/name:en/name/" < old.xml > new.xml). However this will lead 
to some objects having two name tags as it doesn't remove the original one.

If you have minimal Perl and regular expression knowledge, it would 
still be easy to do; you could use the "osmgrep" utility 
(applications/utils/filter/osmgrep.pl) which already has the facility of 
searching for regular expressions within OSM objects, and improve that 
to actually remove the name tag and change name:en to name where a 
name:en tag exists.

Another slightly hack-ish way that works without Perl knowledge would be to

1. use Osmosis with --nk (and/or --wk) to retrieve all nodes/ways from 
the original file which have a name:en tag.

2. use grep to remove the name tags from this, and sed (as above) to 
change the name:en into name;

3. use Osmosis to merge the original file and the newly created file, 
with the newer file having precedence.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"




More information about the dev mailing list