- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用 GEOPANDAS PYTHON 为一组串联的地理数据帧的 map 对象设置不同的颜色(而不是单一颜色)。
我已经尝试过设置facecolor和cmap的传统方法,但是它不适用于串联的地理数据帧。
我想要为 gdf 和边界获得不同的颜色形状(例如红色和蓝色),而不是我当前获得的单一颜色。
这是代码:
import pandas as pd
import geopandas as gpd
from geopandas import GeoDataFrame
import matplotlib.pyplot as plt
import pandas
from shapely import wkt
#Converting an excel file into a geodataframe
Shape=pd.read_excel('C:/Users/user/OneDrive/documents/Excel .xlsx')
print(Shape)
Shape['geometry'] = Shape['geometry'].apply(wkt.loads)
gdf = gpd.GeoDataFrame(Shape, geometry='geometry')
gdf.plot()
#reading another geodataframe
Boundaries=gpd.read_file('C:/Users/user/Desktop/Boundaries/eez_v10.shp')
#concatenating Boundaries and gdfgeodataframes
map=pd.concat([gdf,Boundaries], sort=False)
ax=map.plot(figsize=(20,20))
plt.xlim([47,60])
plt.ylim([22,32])
plt.show()
最佳答案
您不需要执行 concat,只需将两个 df 绘制到同一轴即可。
gdf = gpd.GeoDataFrame(Shape, geometry='geometry')
Boundaries=gpd.read_file('C:/Users/user/Desktop/Boundaries/eez_v10.shp')
ax = gdf.plot(color='blue')
Boundaries.plot(ax=ax, color='red')
关于python - Geopandas 连接形状文件的着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58561912/
我使用来自 OpenStreetMap (link) 的形状文件创建了一个简单的 geopandas map 。 import geopandas as gpd map_gdf = gpd.read_
我正在尝试更改 geopandas 数据框的 CRS。目前的 CRS 是: Name: unknown Axis Info [ellipsoidal]: - lon[east]: Longitude
是否有在 Windows PC 上安装 geopandas 的教程(逐步)?或者哪种方式效果更好? 我已经使用 anaconda 尝试了文档中的解决方案,但最终收到错误(甚至按照建议创建环境)。我什至
我正在尝试按照描述设置 geopandas 对象的 crs here . 示例文件可以从here下载。 import geopandas as gdp df = pd.read_pickle('myS
我目前在 Python 中结合使用 Pandas 和 ArcPy 来完成我的 GIS 工作。我最近听说了 Geopandas 并且有兴趣学习使用它作为 ArcPy 的替代品来进行基本的地理处理操作(空
我读了 .csv文件作为数据框,如下所示: import pandas as pd df = pd.read_csv('myFile.csv') df.head() BoroName g
将 geojson 文件加载到 GeoPandas 后,我得到了预期的名为“几何”的列/特征,其中包含多边形和多边形。 如何将此对象作为 json 或 Python 字典再次取出? 在当前形式下,它是
我正在尝试使用 ANACONDA spyder 运行一个简单的 geopandas 代码。但是,我遇到了错误。 我已经包含了代码和错误如下: —— 这是代码: import geopandas as
我有一个点,我想知道哪个多边形最接近该点。我有点和多边形的地理数据。 最佳答案 您可以使用 distance查找到每个多边形的距离并对它们进行排序以检索最近的。 示例 >>> from shapely
如果我有下面的图,如何将颜色图/图例转换为对数刻度? import geopandas as gpd import matplotlib.pyplot as plt world = gpd.read_
我有一个 geopandas 数据框 geometry idx 0 POLYGON ((-74.2555
我在 python 中使用 GeoPandas 并且有一个有效的多边形 GeoDataframe。 0 POLYGON Z ((68.70999999999999 623.1 0, 3
假设我有以下包含 3 个多边形对象的地理数据框。 import geopandas as gpd from shapely.geometry import Polygon p1=Polygon([(0
我有一个 geopandas 数据框,由 id 和由 2D 点填充的几何列组成。我想连接每个唯一 id 的点来创建一个多边形,以便我的新数据框将多边形作为其几何形状。我的代码目前看起来像这样: pol
我想使用geopandas.rotate()函数根据列中的属性旋转geodataframe中的所有要素。如果我只选择一项功能,我就会成功。然而,对于多行,我相信我需要创建一个 for 循环。 new_
我正在尝试在我的 Mac OS X 上安装 geopandas。 我做了什么: • 下载并安装了适用于 Python 2.7 的 Anaconda here .图形安装程序。 • python --v
我一直收到这个错误,并且已经阅读了其他人的在线访问, ImportError: geopandas, pyshp and shapely must be installed for this figu
您好,我正在尝试将 X 和 Y 坐标列表转换为直线。我想通过 groupby ID 和时间来映射这些数据。只要我 grouby 一列,我的代码就可以成功执行,但是两列是我遇到错误的地方。我引用了这个q
我在使用 read_file 函数时遇到了一些关于 geopandas 和 fiona 的问题。这是我的回溯: df = gpd.read_file('/Users/danqing0703/githu
我有一个在 mapshaper 上看起来像这样的 shapefile: 但是当我尝试用下面的代码在 pandas 中绘制它时 police = gpd.read_file('srilanka_poli
我是一名优秀的程序员,十分优秀!