I'm trying to process a shapefile in basemap by:
shp = fiona.open('Wien_test2.shp')
bds = shp.bounds
shp.close()
extra = 0.01
ll = (float(bds[0]), float(bds[1]))
ur = (float(bds[2]), float(bds[3]))
coords = list(chain(ll, ur))
w, h = coords[2] - coords[0], coords[3] - coords[1]
m = Basemap(
projection='tmerc',
lon_0=16.,
lat_0=48.,
ellps = 'WGS84',
llcrnrlon=coords[0] - extra * w,
llcrnrlat=coords[1] - extra + 0.01 * h,
urcrnrlon=coords[2] + extra * w,
urcrnrlat=coords[3] + extra + 0.01 * h,
lat_ts=0,
resolution='i',
suppress_ticks=True)
m.readshapefile(
'Wien_test2',
'Wien_test2',
color='none',
zorder=2)
Although the code worked well with another shapefile, with this shapefile, I'm getting the error:
Traceback (most recent call last):
File "maps.py", line 104, in <module>
zorder=2)
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/__init__.py", line 2146, in readshapefile
for shprec in shf.shapeRecords():
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/shapefile.py", line 543, in shapeRecords
for rec in zip(self.shapes(), self.records())]
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/shapefile.py", line 515, in records
r = self.__record()
File "/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/shapefile.py", line 480, in __record
value = int(value)
ValueError: invalid literal for int() with base 10: '***********'
I think the issue is somehow that the shapefile is maybe not clean, but I can't figure out how to solve that. Any idea? Many thanks in advance.