[OSM-dev] shp2osm.pl

Anthony osm at inbox.org
Tue Sep 29 20:02:20 BST 2009


Tobias (I am also CCing this to the OSM dev mailing list),

I am using your shp2osm.pl script to convert a shapefile from my property
appraiser's office.  In the output, I'm getting nodes and ways that look
like this:

  <node id='-1' visible='true' lat='28.1728386606802'
lon='-82.5595546812076' />
  <node id='-2' visible='true' lat='28.1719197697234' lon='-82.559526525786'
/>
  <node id='-3' visible='true' lat='28.1719160567277'
lon='-82.5591091374846' />
  <node id='-4' visible='true' lat='28.1710175353132'
lon='-82.5590593295055' />
  <node id='-5' visible='true' lat='28.1710180004217'
lon='-82.5591044662532' />
  <node id='-6' visible='true' lat='28.1710220551224' lon='-82.559499009353'
/>
  <node id='-7' visible='true' lat='28.1710226815735'
lon='-82.5595610568869' />
  <node id='-8' visible='true' lat='28.1728390673479'
lon='-82.5596167297582' />
  <node id='-9' visible='true' lat='28.1728386606802'
lon='-82.5595546812076' />
 <way id='-10' visible='true'>
   <nd ref='-1' />
   <nd ref='-2' />
   <nd ref='-3' />
   <nd ref='-4' />
   <nd ref='-5' />
   <nd ref='-6' />
   <nd ref='-7' />
   <nd ref='-8' />
   <nd ref='-9' />
   <nd ref='-9' />
   <tag k="BLDG" v="0.00000"/>
   <tag k="ACREAGE" v="1.34"/>
[...]
  </way>

As you can see, nodes -1 and -9 are identical.  Fine, I can write a separate
perl script to combine them.  But node -9 is being listed twice in the way.
I looked at the code and found the culprit:

    push @segs, seg_out $last_node, $first_node
      if $first_node && $connect_last_seg;

But I can't figure out quite why that's there or what it's meant to do.  My
understanding is that the proper way for OSM purposes should be:

  <node id='-1' visible='true' lat='28.1728386606802'
lon='-82.5595546812076' />
  <node id='-2' visible='true' lat='28.1719197697234' lon='-82.559526525786'
/>
  <node id='-3' visible='true' lat='28.1719160567277'
lon='-82.5591091374846' />
  <node id='-4' visible='true' lat='28.1710175353132'
lon='-82.5590593295055' />
  <node id='-5' visible='true' lat='28.1710180004217'
lon='-82.5591044662532' />
  <node id='-6' visible='true' lat='28.1710220551224' lon='-82.559499009353'
/>
  <node id='-7' visible='true' lat='28.1710226815735'
lon='-82.5595610568869' />
  <node id='-8' visible='true' lat='28.1728390673479'
lon='-82.5596167297582' />
 <way id='-9' visible='true'>
   <nd ref='-1' />
   <nd ref='-2' />
   <nd ref='-3' />
   <nd ref='-4' />
   <nd ref='-5' />
   <nd ref='-6' />
   <nd ref='-7' />
   <nd ref='-8' />
   <nd ref='-1' />
   <tag k="BLDG" v="0.00000"/>
   <tag k="ACREAGE" v="1.34"/>
[...]
  </way>

But I thought I'd check with you and the dev list to see if I'm perhaps
missing something.

Thanks,
Anthony DiPierro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090929/2bafbed2/attachment.html>


More information about the dev mailing list