有两个形状文件。我使用geopandas文件提取了这两个数据,而且成功了。
File 1 :
zipfile_mobile = "zip://File Saved Location/2020-01-01_performance_mobile_tiles.zip"
mobile_tiles = gp.read_file(zipfile_mobile)
File : 2
zipfile = "zip://File Saved Location/tl_2019_us_county.zip"
counties = gp.read_file(zipfile)
现在我想要查找这些数据的交集。运行以下命令时,我收到了下面的错误消息。
ky_counties = counties.loc[counties['STATEFP'] == '21'].to_crs(4326)
但是,当我执行以下操作时,出现了错误。
Spatial indexes require either `rtree` or `pygeos`. See installation instructions at https://geopandas.org/install.html
但是rtree已经被安装了。
Python版本:3.9.1
另外,请注意以下的库已经被导入。
import geopandas as gp
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from shapely.geometry import Point
from adjustText import adjust_text
import rtree