[OSM-dev] ogr2osm.py error message

PJ Houser stephanie.jean.houser at gmail.com
Wed Mar 9 22:49:09 GMT 2011


Hi,


We are trying to convert shapefiles to osm using ogr2osm script, and running
into a problem. The error message seems to indicate that the problem is line
594 in the code, something about simplifying the last node. We've run this
successfully on some shapefiles, but not on others. Here is the error
message:


G:\PUBLIC\OpenStreetMap\tools\ogr-to-osm>.\run.bat -e 4326
G:\PUBLIC\OpenStreetMap\data\BusNBikeRoutes\Clack_TriMet.shp



G:\PUBLIC\OpenStreetMap\tools\ogr-to-osm>G:\PUBLIC\OpenStreetMap\tools\usr\Python26\python.exe
G:\PUBLIC\OpenStreetMap\tools\ogr-to-osm\ogr2osm.py -e 4326
G:\PUBLIC\OpenStreetMap\data\BusNBikeRoutes\Clack_TriMet.shp

G:\PUBLIC\OpenStreetMap\tools\usr\Python26\lib\site-packages\osgeo\gdal.py:81:
DeprecationWarning: ogr.py was placed in a namespace, it is now available as
osgeo.ogr

  DeprecationWarning)

([('-e', '4326')],
['G:\\PUBLIC\\OpenStreetMap\\data\\BusNBikeRoutes\\Clack_TriMet.shp'])



Preparing to convert file
G:\PUBLIC\OpenStreetMap\data\BusNBikeRoutes\Clack_TriMet.shp (extension is
shp) into G:\PUBLIC\OpenStreetMap\data\BusNBikeRoutes\Clack_TriMet.osm

Will assume that source data is in EPSG:4326



Parsing features



['RTE', 'DIR', 'KEYITEM', 'RTE_DESC', 'DIR_DESC', 'ROUTE', 'FREQUENT',
'TYPE', '

LENGTH']

Got layer field definitions



Nodes: 5230

Way segments: 5508

Lines: 2135

Areas: 0



Joining segments



Simplifying line segments

Traceback (most recent call last):

  File "G:\PUBLIC\OpenStreetMap\tools\ogr-to-osm\ogr2osm.py", line 594, in
<module>

    for nodeID in segmentNodes[segmentID]:

KeyError: -8177

....
here is what's around line 594 in the script:

print

print "Simplifying line segments"

for line in lineSegments.values():

    #print line

    for segmentID in line:    # No need to check the last segment, it could
not be simplyfied

        #print segmentID

        #print segmentNodes[segmentID]

        for nodeID in segmentNodes[segmentID]:

            simplifyNode(nodeID)

            #simplifyNode(segmentNodes[segmentID][0])    # last node in
segment


Thanks for any help!
--
PJ Houser
Trimet
GIS intern, 503-962-5711 (office)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20110309/c02c613b/attachment.html>


More information about the dev mailing list