10m road has bad record #11

Open
pelson opened this Issue Dec 13, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@pelson

pelson commented Dec 13, 2012

Hope you don't mind me opening an issue directly on here rather than posting elsewhere.

I was investigating a failure of some software which was blowing up when reading the 10m roads shapefile.
It turns out that my code doesn't handle empty points in a record, which is precisely what one of the records in this particular shapefile have:

import shapefile

fname = 'natural_earth/cultural/10m_roads.shp'
r = shapefile.Reader(fname)
rec = r.shapeRecord(8126)
field_names = [field[0] for field in r.fields[1:]]
for name, field in zip(field_names, rec.record):
    print '{}: {}'.format(name, str(field).strip())
print 'POINTS: ', rec.shape.points

Resulting in:

scalerank: 100
featurecla: Road
...
edited: Mystry can't be deleted?
name: 
...
POINTS: []

Obviously, I will update my code to handle a record with no points, but I wanted to let you know about this so that you can remove the lingering entry if you so wish.

Cheers,

@nvkelso

This comment has been minimized.

Show comment
Hide comment
@nvkelso

nvkelso Dec 13, 2012

Owner

This is a duplicate of #4.

Owner

nvkelso commented Dec 13, 2012

This is a duplicate of #4.

@pelson

This comment has been minimized.

Show comment
Hide comment
@pelson

pelson Dec 14, 2012

Feel free to close this then. I notice #4 doesn't specifically mention the road shapefile (it does mention railroads, timezone and georaphic_lines though).

pelson commented Dec 14, 2012

Feel free to close this then. I notice #4 doesn't specifically mention the road shapefile (it does mention railroads, timezone and georaphic_lines though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment