问题标签 [shapely]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - Shapely中两个几何图形最近点的坐标
有一条折线,其中包含顶点坐标列表 = [(x1,y1), (x2,y2), (x3,y3),...] 和一个点 (x,y)。在 Shapely 中,geometry1.distance(geometry2)
返回两个几何图形之间的最短距离。
但我还需要找到最接近点(x,y)的线上点的坐标。在上面的示例中,这是LineString
对象上距离 1.4142135623730951 单位的点的坐标Point(4,8)
。该方法distance()
在计算距离时应该有坐标。有没有办法从这个方法返回它?
python - 导入 shapely.geometry 引发 AttributeError:未找到函数“GEOSversion”
import shapely.geometry
在解释器中工作正常,但代码在运行时抛出此错误:
也试过
但是Shapely过去运行完美。
在 SO 中没有找到有关此问题的任何帖子。任何帮助深表感谢。谢谢!
从此链接安装的 Shapely‑1.3.2.win‑amd64‑py2.7.exe应该包含 GEOS 依赖项。
在 Win7 64 位上运行 Python 2.7 64 位 Anaconda。将 Eclipse 与 PyDev 一起使用
python - 如何在 Python 中合并多个缓冲区对象?
假设我有几个 python.shapely.LineString 对象。我已经围绕它们建立了缓冲区,获得了几条缓冲线。现在我想将所有这些缓冲区形状合并为一个(所有这些形状的逻辑总和),但我不能将它们视为 Polygon 对象,因为它们只是缓冲线。任何建议如何做到这一点?
python - Apply a pairwise shapely function on two numpy arrays of shapely objects
I have two arrays of different length. One contains shapely polygons, the other contains shapely points. I want to run the a_polygon.contains(a_point) shapely function for every possible combination of elements in both arrays.
I was looking at this post as building a two column matrix with all the possible combinations in the rows could be a desirable intermediate step. But the loop in the 'cartersian(arrays)' function might hinder performance when the input data is huge.
I tried to broadcast one of the arrays, and then applying the shapely function:
but that, off course, does not work. I am aware of the recently released geopandas library, but it is not an option for my Canopy installation.
python - 如何从两个点数组创建一个 Shapely LineString
我正在尝试创建两个数组的单个 LineString 对象。我已经尝试了多种方法,但我不断得到:
TypeError: list indices must be integers, not tuple
python - ImportError:没有名为 _vectorized 的模块
我正在为我的 Python 和 Plone 项目使用 Shapely 包。在鸡蛋部分下的 packages.cfg 文件中,我使用 shapely 像这样下载
在 bin/buildout 期间,我发现 shapely.vectorized 存在问题。错误似乎是这样的
我为我的 python 函数创建了单元测试。当我运行我的文件时,我得到了错误。错误的追溯是
shapely/tests/__init__.py
:
shapely/tests/test_vectorized.py:
shapely/vectorized/__init__.py:
我不知道矢量化有什么问题。任何人都可以帮忙。
python - Python / 匀称感人的包含
我正在尝试编写一个算法,它可以检查一个多边形是否在另一个多边形内,但它们共享一个边界。
除了检查 poly2 中的至少一个点是否在 poly 内并且它们不交叉(poly 内外的点)之外,还有其他方法吗?
python - 在矩形联合中找到洞?
我在单位正方形(红色)中和周围有许多随机矩形(黑色),需要提取单位正方形内未被任何矩形覆盖的所有多边形区域。
看起来这可以用 Shapely 完成,当我有矩形的联合(绿色)时,我已经到了这一点,但我不知道如何从单位正方形中减去它并检索多边形列表。
这是我生成测试数据的代码:
animation - Python matplotlib:由几个pyplot.figure-s组成的动画
我制作了一个“绘图仪(x)”函数,它读取 a 中的时间序列并返回由两个轴组成pd.DataFrame
的图形( )。return fig
一个是 a pyplot.figure.add_subplot(111)
,我在其中添加descartes.PolygonPatch(shapely.Polygon(y))
-es。第二个是 a pyplot.figure.add_axes
,它包括一个带有自定义颜色图的颜色条。
我需要第二个函数来制作一部电影,以 2 fps 的速率显示时间序列中每个时间步的情节。我这样做了:
问题1:我应该怎么做才能使这项工作?
我知道一个选项是循环应用我已经必须创建一系列 .png-s 的函数的时间序列,然后直接在 unix 终端中使用 mencoder 创建一个 .avi。然而,颜色条和大多数被映射的形状多边形的值不会随时间而变化,并且每次需要绘制它们时都会消耗大量计算。此外,我需要添加一个mpl_toolkits.basemap.Basemap
也不会改变的。这使得这种“.png-series”方法不方便。我也不能使用sys
导入:我需要在 Python 中做所有事情。
我需要blit=True
在 matplotlib.animation 中使用以避免重绘特征,如果它们在前一个框架中是相同的。它也适用于底图吗?
问题 2:如何在视频中集成静态底图?
python - Python不能匀称地导入
我在 Mac OSX 上使用 Python3.4,我正在尝试导入。然而,我无法这样做。这是我的回溯:
我想我可能必须设置 GEOS_LIBRARY_PATH,但我不确定将其设置为什么。
这是/Users/tc9/homebrew/Cellar/geos/3.4.2/lib
我 brew install geos 之后的 ls:
我编辑并采购了我的~/.profile
,但这并没有解决问题:
任何人都可以为我指出一个解决方案的方向,以使导入变得匀称吗?谢谢。