logo separator

[mkgmap-dev] how to remove ways and nodes by a specific tag

From Marko Mäkelä marko.makela at iki.fi on Fri May 14 07:06:00 BST 2010

On Fri, May 14, 2010 at 10:22:13AM +0800, maning sambale wrote:
>> Is there a way to do this in the styles?  I basically want some ways
>> and nodes completely removed based on a specific tag and not just the
>> tags contained in it.

Can you do it by preprocessing? In order to get rid of buggy 
mass-imported landuse multipolygons in Russia, I filter them with a bit 
of Perl in my osm2img.sh script:

OSM=finland.osm
OSM_BZ2="$OSM".bz2
wget -cN http://download.geofabrik.de/osm/europe/"$OSM_BZ2"

bzip2 -dc "$OSM_BZ2"|
perl -e \
'my $del=0;
while(<>){
     $del=1 if (/<relation.* version="1".* user="usm78-gis"/);
     s/(<node id="28954644".*lat=)"60\.51564"/$1"59.326172"/;
     s/(<node id="29193143".*lon=)"24\.12826"/$1"19.072266"/;
     print unless $del;
     $del=0 if m|</relation>|;
}' > "$OSM"

This bit of Perl also moves the endpoints of the coastline, so that they 
will touch the tile borders.

If you want to filter out by generic key=value pairs rather than by the 
"built-in tags" such as id, version, user, then it might be easier to 
use Osmosis.

	Marko



More information about the mkgmap-dev mailing list