2017-11-15 13 views
0

입력 파일이 도시 지역에있는 교차로에 대한 함수를 만들고 쿼리 상자를 사용하여 출력 파일을 생성하는 데 사용하고 있습니다. 해당 쿼리 상자에있는 건물(Python) Rtree 교차 및 피오나 질문

import matplotlib.pyplot as plt 
import matplotlib as mpl 
from mpl_toolkits.basemap import Basemap 
import fiona 
import fiona.crs 
import rtree 


input_file = 'se_england_clean.shp' 
out_file = 'se_england_out' 
file_index = 'Rtree_index_east.idx' 

query_box = [-0.0957870483,51.5134165224,-0.08664608,51.5192383994] 



def write_clipped_file(name_file_in, out_file, file_index): 
idx = rtree.index.Index(file_index) 
idx.insert(0, (input_file)) 
list(idx.intersection((query_box)))[0] 
count = 0 
with fiona.open(input_file, 'w') as out_file : #? 
    for building in out_file: #? 

내 코드는 지금까지 맞아,하지만 난이 즉시 문제가있는 경우 없음 아이디어 : 는 첫째, 내가 원하는 피오나와 함께 입력 Shape 파일을 열고 새로운 (클리핑) Shape 파일하는 방법을 모른다 출력물을 생산한다. 나는 색인 목록을 순환시키고, 원하는 건물을 선택하고, 새로운 파일 'out_file'에 써 넣고 싶습니다. 둘째, 오류가 발생합니다 :

RTreeError: Coordinates must be in the form (minx, miny, maxx, maxy) 

답변

0
idx.insert(0, (input_file)) 

당신은 트리가 아닌 파일 이름으로 좌표를 삽입해야합니다.