2017-12-06 3 views
0

내 모양 파일을 파이썬 노트북에 구현하는 데 문제가 있습니다.모양 파일 가져 오기 및 사용 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

코드를 스크린 샷으로 게시하지 마십시오. 코드와 스택 트레이스 모두를 올바른 형식의 텍스트로 포함하십시오! –

답변

관련 문제