[OSM-dev] Two scripts to make excerpts of planet.osm

Ralf Zimmermann Ralf at Zimmermann.com
Fri Nov 3 21:45:45 GMT 2006


Hi Nick,

I tried your scripts. I changed the following line in planetosm-excerpt-tags.pl:
214:			my ($id,$lat,$long) = ($main_line =~ /^\s*<node id=['"](\d+)['"].*?lat=['"]?(\-?[\d\.]+)['"]? lon=['"]?(\-?[\d\.]+e?\-?\d*)['"]?/);
(Changed " " to ".*?")

I needed this because the planet.osm files differ to the ones written by JOSM.
When writing a node element, they behave differently:
   planet.osm: <node id="" lat="" lon="" timestamp=""/>
   josm.osm:   <node id='' timestamp='' lat='' lon='' />
Obviously, JOSM writes the timestamp to a different place in the node definition. The script needs to be able to cope with that.


OSM files written by JOSM did not work with your script, therefore I made the patch.

The same change is needed in planetosm-excerpt-area.pl:
109:		my ($id,$lat,$long) = ($line =~ /^\s*<node id=['"](\d+)['"].*?lat=['"]?(\-?[\d\.]+)['"]? lon=['"]?(\-?[\d\.]+e?\-?\d*)['"]?/);

With those changes, your scripts work just fine for me. Thanks a lot!

Ralf



Nick Burch wrote:
> On Thu, 2 Nov 2006, Joerg Ostertag (OSM Munich/Germany) wrote:
>> what about
>>  utils/osm-subset/osm-subset.pl
> 
> I hadn't come across that one before. We should really have a central list 
> of these scripts, what they do etc, so we can try to avoid duplicating 
> them...
> 
> Nick
> 
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
> 
> 





More information about the dev mailing list