- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试按照描述设置 geopandas 对象的 crs
here .
示例文件可以从here下载。
import geopandas as gdp
df = pd.read_pickle('myShp.pickle')
我上传屏幕截图以显示坐标值
然后,如果我尝试更改 crs
,则多边形的值不会更改
tmp = gpd.GeoDataFrame(df, geometry='geometry')
tmp.crs = {'init' :'epsg:32618'}
我再次显示截图
如果我尝试:
import geopandas as gdp
df = pd.read_pickle('myShp.pickle')
df = gpd.GeoDataFrame(df, geometry='geometry')
dfNew=df.to_crs(epsg=32618)
我得到:
ValueError: Cannot transform naive geometries. Please set a crs on the object first.
最佳答案
像这样设置 crs
:
gdf.crs = {'init' :'epsg:32618'}
不会转换您的数据,它只会设置 CRS(它基本上是说:“我的数据在此 CRS 中表示”)。在大多数情况下,在使用 geopandas.read_file
读取数据时已经设置了 CRS(如果您的文件具有 CRS 信息)。所以只有当你的数据还没有CRS信息的时候,你才需要以上。
如果您真的想将坐标转换为不同的 CRS,您可以使用 to_crs
方法:
gdf_new = gdf.to_crs(epsg=32618)
参见 https://geopandas.readthedocs.io/en/latest/projections.html
关于python - Geopandas:无法更改 geopandas 对象的 crs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56274566/
尽管有很多 CRS 预测等帖子,但我无法阻止我的城镇下沉。 如果我去 Google Maps并输入 -35.016, 117.878奥尔巴尼镇位于旱地(如下图): 如果我在 R 中输入纬度/经度并尝试
我下载了 MODIS .hdf 文件。使用 xarray 加载它,它给了我一个属性 ds.Proj4String == ' +a=6378137.0 +b=6356752.3142451793 +no
我在使用传单 map 插件和简单的 crs 时遇到问题。当我开始玩它时,我使用默认的 CRS 和缩放级别 0-6,它工作正常。但我需要使用像素坐标,而不是地理坐标,所以我切换到 Simple CRS,
您好,我了解 CRS 稀疏矩阵的工作原理,但我有一个问题:如果一行为空(仅填充 0)会发生什么?例如让第5行为空,row_ptr(5)应该包含什么? 最佳答案 行指针值将被重复,即行指针将类似于[1,
我在给定的 CRS 中有一个点的字符串表示形式(即 EPSG:3035),例如“N10160E21266”。我想使用GeoTools解析来创建DirectPosition,或任何其他 X/Y 表示(以
我已经使用自定义 CRS (EPSG:32633) 设置了传单 map 。该 map 通常运行良好,但每当我尝试在移动设备上使用捏合来缩放 map 时它就会卡住。 双指缩放时出现的错误是“未捕获错误:
我不熟悉稀疏矩阵的使用,但现在需要在我的工作中使用它以节省空间。我了解以下矩阵: 10 0 0 0 -2 0 3 9 0 0 0 3 0
我有一些网格数据(二维数组),其中有一些与之关联的地理空间元数据。边界位于具有 WSG84 lon lat 坐标的 jts 多边形中。多边形是一个矩形,但不是轴对齐的(不是边界框)。 我正在尝试创建一
是否有一种简单的方法可以将简单特征(sf 对象)的边界转换为另一个 CRS? 函数的结果 st_bbox()属于 bbox .无法使用 st_transform()将其转换为另一个 CRS。 我正在使
很抱歉为此打扰你,但我可能已经为这个问题生气了 5 个小时,但我没能解决它。 我有一个包含大约 37,000 个条目的数据集。它们每个都有自己的 Lon 和 Lat 坐标值。检查整体值,它们的范围分别
我正在尝试更改 geopandas 数据框的 CRS。目前的 CRS 是: Name: unknown Axis Info [ellipsoidal]: - lon[east]: Longitude
我有一些“道路”作为 sp 对象: class : SpatialLinesDataFrame features : 17360 extent : 490176.4, 56
处理稀疏矩阵时,如何转换Matrix Market format进入 CRS(压缩行存储)? 最佳答案 你看过BeBOP Sparse Matrix Converter了吗?源代码?它链接自您引用的页
我正在使用 Rasterio 在 Python 中读取 jpg 图像及其关联的世界文件,如下所示: import rasterio with rasterio.open('/path/to/file.
我正在尝试安装 SCIP 优化套件版本 3.1.0 http://scip.zib.de/download.php?fname=scipoptsuite-3.1.0.tgz 通过在 scipoptsu
我遇到了一个奇怪的问题:当使用 GeoPandas(在 Jupyter Notebooks 中)时,.crs 数据在我的第一个笔记本中工作正常,然后在我的第二个笔记本中丢失。 只要看看图书馆附带的一张
我尝试实现稀疏矩阵存储格式。维基百科说:this 我需要CRS 算法。但是我无法理解算法到底。我有链接示例中的矩阵 0 0 0 0 5 8 0 0 0 0 3 0 0 6 0 0 和3个数组 A
在 Leaflet 中的示例中(对于非地理图像),他们设置“边界”。我试图了解他们如何计算这些值 var bounds = [[-26.5,-25], [1021.5,1023]]; 原点在左下角,y
给定以下 GeoDataFrame: h=pd.DataFrame({'zip':[19152,19047], 'Lat':[40.058841,40.202162],
尽管我的问题有答案 How to create an accurate buffer of 5 miles around a coordinate in python? ,但我不能代表它。 我有一系列
我是一名优秀的程序员,十分优秀!