有两个shapefile。我已经使用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发布于 2020-12-19 15:38:19
在我从下面的代码中删除".to_crs(4326)“之后,代码执行成功。
ky_counties = counties.loc[counties['STATEFP'] == '21'].to_crs(4326)相同的CRS通常可以以多种方式引用。例如,最常用的CRS之一是WGS84经纬度投影。这可以通过使用权威代码"EPSG:4326“来参考。这意味着在这种情况下不需要进行此转换。
https://stackoverflow.com/questions/65283076
复制相似问题