Skip to content

Loading…

10m road has bad record #11

Open
pelson opened this Issue · 2 comments

2 participants

@pelson

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
Owner

This is a duplicate of #4.

@pelson

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).

@nvkelso nvkelso closed this
@nvkelso nvkelso reopened this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.