최근에 geopandas를 사용하여 도시의 쉐이프 파일을 처리하기 시작했습니다. 최근 geopandas에서 contains 메소드를 사용하여 문제점을 발견했습니다. 문제는 다음과 같습니다 :geopandas contains 메서드가 폴리곤을 반환하지 않습니다
동일한 crs 투영을 가진 2 개의 다른 shapefiles가 있습니다 : 구역과 섹션. 지구와 함께있는 모든 단면 다각형을 가져와야합니다. contains 메소드에 대해 읽었는데 정확하게 필요한 것 같지만 실행하는 순간에 반환되는 다각형은 비어 있습니다. 이상한 것은 여기에서 intersects 메서드를 사용할 때 대신 지구 내의 섹션과 모든 인접 섹션을 반환하는 것을 포함합니다. 나는 그것을 얻으려고 노력이나 방법 자체에 문제가있어 방법에 문제가
districts = GeoDataFrame.from_file('districts_WGS84.shp')
sections = GeoDataFrame.from_file('sections_WGS84.shp')
districts.crs == sections.crs #To be sure the files share the same crs
#The following line returns an empty array, but it should return all seccions within a district
print len(sections[sections.contains(districts.geometry[34]) == True])
# districts.geometry[34] is a fixed discrict in order to run a test
#The following line returns the list of all sections within the district plus adjacent ones
print len(sections[sections.intersects(districts.geometry[34]) == True])
있습니까 :
다음은 내 코드입니다?
감사
여기 내 문제를 반복하는 모양 파일이 있습니다.