[OSM-dev] extract_polygon_0.5.pl bugs

James Marca jmarca at translab.its.uci.edu
Fri Sep 28 01:47:23 BST 2007


Hi, 

apologies in advance and corrections requested if I'm not following
protocol on reporting bugs.

I found two bugs in extract-polygon-0.5.pl.  First, the usage message
for bounding boxes is incorrect, reversing the order of min and max
lat and lon compared to the way they are parsed.

It also fails if ids are negative (as is the case with the Tiger Line
converter output osm files), as Bit::Vector converts them to unsigned
ints, so they exceed the bounds given for the various bit vector
objects.

I have fixed both problems, but it may take be a while to extract
usable patches for the negative number problem as my version (mostly)
passes perlcritic at severity 1 so the diff is huge.

My solution is if the ids are negative, add the (negative) nodeid,
wayid, and relid to the maxnodes, maxways and maxrelations variables
(so that they aren't greater than the max size, and so that there can
also be positive ids).  I'll try to extract a patch, but the approach
presumes that ids are numbered sequentially, etc. so it isn't foolproof.

Scanning the output of git diff -p, this snippet should fix the usage
problem, with some line offset

@@ -96,7 +104,7 @@ usage: $prog [-h] [-c number] [-i file] [-o file] [-r file] -p file [-d]
  -c num   : reduce the number of points in the polygon by num %.  This 
             only takes effect if the polgon has more than 100 points.
  -b bbox  : use bounding box instead of polygon (bbox being four comma-
-            separated numbers: bllon,bllat,trlon,trlat).
+            separated numbers: bllat,bllon,trlat,trlon).
  -p file  : file containing the polygon definition.
  -i file  : OSM planet file to process.
  -o file  : OSM planet file to output.

Regards,
James




More information about the dev mailing list