- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
目标:在同一个 pyplot 图上绘制 MultiPolygon(陆地)和 MultiLinestring(河流)。将土地涂成白色。
问题:似乎多线串显示为通过自动关闭所有线串以使它们成为多边形而构建的多多边形
Telltale:将 MultiPolygon 着色为白色时,它不会为看似由 MultiLinestring 中的 Linestring 制成的多边形着色
这是可重现的代码:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader
from cartopy.feature import ShapelyFeature
# creates a map
map_projection = ccrs.PlateCarree(central_longitude=0.0, globe=None)
map_figure = plt.figure()
map_subplot = plt.axes(projection=map_projection)
# limits the display bounds of the map
map_subplot.set_extent((5.2, 31.4, 35, 54.3), crs=map_projection)
# adding land from a local shp (source : Natural Earth website)
# facecolor = white
landshpfilename = "Central Europe _ lands minus lakes.shp"
landshapereader = shpreader.Reader(landshpfilename)
landshape_feature = ShapelyFeature(landshapereader.geometries(), map_projection, facecolor='white',edgecolor='black')
map_subplot.add_feature(landshape_feature)
# adding large river from a local shp (source : Natural Earth website)
# edgecolor = blue
largeriversshpfilename = "Central Europe _ large rivers minus lakes.shp"
largeriversshapereader = shpreader.Reader(largeriversshpfilename)
largeriversshape_feature = ShapelyFeature(largeriversshapereader.geometries(), map_projection,edgecolor='blue')
map_subplot.add_feature(largeriversshape_feature)
# verifying the geom_type of the first objects in the shapefiles
# putting it as a title
land_geom_type_text = ' '.join(['lands geom_type :',next(landshape_feature.geometries()).geom_type])
river_geom_type_text = ' '.join(['rivers geom_type :',next(largeriversshape_feature.geometries()).geom_type])
map_figure.suptitle('\n'.join([land_geom_type_text,river_geom_type_text]))
plt.show()
结果如下: rendered map
问题:如何解决?
最佳答案
设置facecolor='none'
将阻止 matplotlib 填充生成的底层路径。一个快速可重现的案例:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
ax = plt.axes(projection=ccrs.PlateCarree())
# Create a feature for States/Admin 1 regions at 1:50m from Natural Earth
states_provinces = cfeature.NaturalEarthFeature(
category='physical',
name='rivers_lake_centerlines',
scale='110m',
)
ax.add_feature(states_provinces, edgecolor='gray', linewidth=5)
ax.coastlines()
保持其他所有内容相同,但更改特征构造以设置不设置面颜色会产生所需的结果:
states_provinces = cfeature.NaturalEarthFeature(
category='physical',
name='rivers_lake_centerlines',
scale='110m',
facecolor='none'
)
关于python - Shapely MultiLinestring 在 Pyplot 中显示为 MultiPolygon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51289751/
我有 2 个相交的 OGR 多边形,因此我想将它们级联并联。我尝试了这个,但它返回给我空并且不合并它。似乎这仅适用于多边形,不适用于多重多边形。最好的方法是什么? >>geom = ogr.Geome
从包含相当多(大约 20000)个可能部分重叠的多边形的 shapefile 开始,我需要提取所有通过与不同“边界”相交而产生的子多边形。 在实践中,从一些模型数据开始: library(tibble
我尝试在我的 postgre 数据库中添加 MultiPolygon 几何图形,因此我使用了以下 SQL 语句: 'INSERT INTO potentiel_foncier_ccry (nature
我正在尝试将我的 polygon 列类型更改为 multipolygon 列类型。 我的代码很简单。 change_column :messages, :area_shape, :multipolyg
我正在读取一组包含大量 multypoligons 的数据。我正在使用 Geotools,我想将此列表存储在 mysql 数据库表中。 我不知道如何以有效的方式存储形状并能够重新创建多多边形对象。 如
OpenLayers 3.10.1 中的默认标签标记 MultiPolygon 的每个部分。我想知道是否可以只标记 MultiPolygon 中的第一个多边形。 最佳答案 您可以为带有 geometr
我正在使用geotools库来提取位置信息。这样我就得到了一个类型的对象 class com.vividsolutions.jts.geom.MultiPolygon 我现在想通过 jdbc 连接将此
我正在使用geotools库来提取位置信息。这样我就得到了一个类型的对象 class com.vividsolutions.jts.geom.MultiPolygon 我现在想通过 jdbc 连接将此
我将 leaflet.js 与 postgis (postgres) 一起使用。我想将多面体转换为几何图形以存储在数据库中。但是我收到了这个错误: An error occurred when exe
我有一个表 Town,其列 TownBoundary 包含相关城镇的多边形(geography 数据类型)。 对于每个城镇,我都会获得生成 KML(XML) 文件所需的多边形数据,例如: sqlg =
我有一个世界国家数据集,想在本初子午线上拆分它,并将数据重新集中在太平洋上。 我正在尝试使用简单功能 (sf) 来执行此操作,但遇到了一个我无法解决的对象类型问题。 为了拆分数据,我尝试了以下操作:
我有一个由大约 100 个条目(多多边形几何图形)组成的 cartoDB 数据集,我使用 cartodb.js API 检索该数据集。单击区域时更改给定条目(倍数)的不透明度的最佳方法(性能方面)是什
所以这是我第一次做一个涉及 map 和图层的项目, map 上有很多点和很多多边形。 我倾向于为点和多边形创建单独的表,然后在它们与图层表之间创建多对多关系。如果这样做,我最终会得到 5 个表:poi
我有以下MultiPolygon: MULTIPOLYGON ( ( (10.8849956 49.8901705, 10.8849507 49.8902499, 10.884969 49.89025
我需要将PostgreSQL的几何(MultiPolygon)类型变量存储到java变量中这是因为我尝试将几何列添加到非空间表以使用 map 服务器查询 map 我试图将它存储在一个字符串中,这导致了
我正在从 Trimble 导入一些 OSM 数据到 PostGIS 数据库中,将其作为 Django 应用程序的一部分进行处理。这适用于点和线,但我正在努力处理多边形。 导入似乎工作正常: shp2p
有没有人用PHP解析过MySql中的Polygon/Multipolygon几何数据?我是 MySQL 空间函数的新手。请帮我从 MySQL 中的多面体中获取经纬度点。 我有一个表格,其中有一个类型为
我有两个 GeoDataFrame。一个是爱荷华州,另一个是北美 future 72 小时内预料到的降雨。我想创建一个覆盖爱荷华州的降雨预报的 GeoDataFrame。但是我得到一个错误。 stat
我正在从不同来源收集位置信息并将所有内容存储在 MongoDb 集合中。除了具有单一纬度/经度坐标的点位置外,我还存储区域。 现在,一个数据给我的位置信息为 GeometryCollection,但所
如何在 NodeJs sequelize 中创建具有多多边形数据类型的表字段? myfield: { type: ?????, allowNull: true } MySQL表结构是-
我是一名优秀的程序员,十分优秀!