shapely

How to calculate the common volume/intersection between 2, 2D kde plots in python?

为君一笑 提交于 2020-07-20 04:14:12
问题 I have 2 sets of datapoints: import random import pandas as pd A = pd.DataFrame({'x':[random.uniform(0, 1) for i in range(0,100)], 'y':[random.uniform(0, 1) for i in range(0,100)]}) B = pd.DataFrame({'x':[random.uniform(0, 1) for i in range(0,100)], 'y':[random.uniform(0, 1) for i in range(0,100)]}) For each one of these dataset I can produce the jointplot like this: import seaborn as sns sns.jointplot(x=A["x"], y=A["y"], kind='kde') sns.jointplot(x=B["x"], y=B["y"], kind='kde') Is there a

Python: Closest Point to a line

↘锁芯ラ 提交于 2020-07-18 08:16:10
问题 I have the following question. I have a box full of coordinates and three points, which build up a line. Now i want to calculate the shortest distance of all box coordinates to that line. I have three methods to do that and the vtk and numpy version always have the same result but not the distance method of shapely. But i need the shapely version, because i want to measure the closest distance from a point to the hwole line and not to the seperate line segments. Here is an example code so far

Convert Multipolygon to Polygon in Python [closed]

余生长醉 提交于 2020-07-15 02:29:53
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 months ago . Improve this question Is it possible to convert a Multipolygon into a Polygon which fills all holes or missing inner areas using Shapely? I have been trying since a while but I can't find it in the documentation. The following image I show an example of a multipolygon with those holes I want to

Convert Multipolygon to Polygon in Python [closed]

隐身守侯 提交于 2020-07-15 02:28:20
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 months ago . Improve this question Is it possible to convert a Multipolygon into a Polygon which fills all holes or missing inner areas using Shapely? I have been trying since a while but I can't find it in the documentation. The following image I show an example of a multipolygon with those holes I want to

Convert Multipolygon to Polygon in Python [closed]

北战南征 提交于 2020-07-15 02:28:10
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 months ago . Improve this question Is it possible to convert a Multipolygon into a Polygon which fills all holes or missing inner areas using Shapely? I have been trying since a while but I can't find it in the documentation. The following image I show an example of a multipolygon with those holes I want to

OSMNX - visualizing waterway together with footprints and ground

偶尔善良 提交于 2020-06-16 04:00:39
问题 I am trying to plot waterway together with ground (street network/map) and footprints (buildings). My problem is that the waterways are large closed polygon areas , which means instead of plotting a nice blue river with correct thickness it plots the river all over half of the figure (and there's no water there IRL...). This is what I have in Jupyter-Lab so far (example coordinates with few roads for quick test): %matplotlib inline import matplotlib.pyplot as plt import osmnx as ox ox.config

Python Shapely Install Not working?

纵饮孤独 提交于 2020-06-12 09:01:08
问题 any thoughts? I've tried uninstalling Shapely and installing with PIP I have Anaconda and installed Fiona fine and Shapely seemingly fine. Simple code: import fiona import shapely dirVar = "C:\\Users\\me\\Desktop\\geocode\\" with fiona.open(dirVar + "Regions.shp") as fiona_collection: shapefile_record = fiona_collection.next() shape = shapely.geometry.asShape(shapefile_record['geometry']) #GET ERROR HERE point = shapely.geometry.Point(32.398516, -39.754028) # longitude, latitude if shape

Python Shapely Install Not working?

和自甴很熟 提交于 2020-06-12 09:00:59
问题 any thoughts? I've tried uninstalling Shapely and installing with PIP I have Anaconda and installed Fiona fine and Shapely seemingly fine. Simple code: import fiona import shapely dirVar = "C:\\Users\\me\\Desktop\\geocode\\" with fiona.open(dirVar + "Regions.shp") as fiona_collection: shapefile_record = fiona_collection.next() shape = shapely.geometry.asShape(shapefile_record['geometry']) #GET ERROR HERE point = shapely.geometry.Point(32.398516, -39.754028) # longitude, latitude if shape

Polygon touches in more than one point with Shapely

末鹿安然 提交于 2020-05-10 10:18:32
问题 I have a list of Shapely polygons in Python. To find out which polygon touch is easy, using the .touches() method. However, I need something that returns True only when the polygons share more than one point (in other words shares a border). Let me illustrate: In [1]: from shapely.geometry import Polygon In [2]: polygons = [Polygon([(0,0),(0,1),(1,1),(1,0)]), Polygon([(1,0),(1,1),(2,1),(2,0)]), Polygon([(2,1),(2,2),(3,2),(3,1)])] In [3]: polygons[0].touches(polygons[1]) Out[3]: True In [4]:

Polygon touches in more than one point with Shapely

陌路散爱 提交于 2020-05-10 10:17:49
问题 I have a list of Shapely polygons in Python. To find out which polygon touch is easy, using the .touches() method. However, I need something that returns True only when the polygons share more than one point (in other words shares a border). Let me illustrate: In [1]: from shapely.geometry import Polygon In [2]: polygons = [Polygon([(0,0),(0,1),(1,1),(1,0)]), Polygon([(1,0),(1,1),(2,1),(2,0)]), Polygon([(2,1),(2,2),(3,2),(3,1)])] In [3]: polygons[0].touches(polygons[1]) Out[3]: True In [4]: