2017-12-06 10 views
0

私のシェイプファイルを私のpythonノートブックに実装する際に問題があります。シェイプファイルのインポートと使用Pythonとmatplotlib

パスの場所が正しいにもかかわらず、自分のファイルを参照していないようです。

import shapefile as shp 
sf = shp.Reader("/Shape/mygeodata/northern-ireland") 

#create figure to draw map and set its size 
fig, ax = plt.subplots(figsize=(10,20)) 


#create map with the below code 
m = Basemap(resolution='h', # c, l, i, h, f or None 
      projection='merc', 
      lat_0=0, lon_0=0, 
      llcrnrlon=-8.239, llcrnrlat=53.9911, urcrnrlon=-5.3723, urcrnrlat=55.276) 


#define how map is displayed 
m.drawmapboundary(fill_color='#46bcec') 
m.fillcontinents(color='#f2f2f2',lake_color='#46bcec') 
m.drawcoastlines() 


#for loop to plot the longitude and latitude of each crime 
for i, row in crimeDataNI.iterrows(): 
     lat = row['Latitude'] 
     lon = row['Longitude'] 
     x,y = m(lon, lat) 
     m.plot(x, y, 'o', markersize=6, color='#444444', alpha=0.8) 

#try and read in Northern Ireland police force boundaries 
m.readshapefile(sf, 'northern-ireland') 

、私は次のエラーを取得しています:

ShapefileException:/Shape/mygeodata/northern-ireland.dbfまたは/Shape/mygeodata/northern-ireland.shpを開くことができません。

+1

コードをスクリーンショットとして投稿しないでください。コードと完全なスタックトレースを適切に書式設定されたテキストとして含めてください! –

答えて

関連する問題