shapely

Extract points/coordinates from a polygon in Shapely

北战南征 提交于 2019-12-03 05:30:41
问题 How do you get/extract the points that define a shapely polygon? Thanks! Example of a shapely polygon from shapely.geometry import Polygon # Create polygon from lists of points x = [list of x vals] y = [list of y vals] polygon = Polygon(x,y) 回答1: So, I discovered the trick is to use a combination of the Polygon class methods to achieve this. If you want geodesic coordinates, you then need to transform these back to WGS84 (via pyproj , matplotlib 's basemap , or something). from shapely

Check if geo-point is inside or outside of polygon

穿精又带淫゛_ 提交于 2019-12-03 03:47:23
问题 I am using python and I have defined the latitudes and longitudes (in degrees) of a polygon on the map. My goal is to check if a generic point P of coordinates x,y falls within such polygon. I would like therefore to have a function that allows me to check such condition and return True or False if the point is inside or outside the polygon. In this example the point is outside so the result would be False Question : Is there a library/package that allows to reach my goal? if yes which one do

Check if geo-point is inside or outside of polygon

喜欢而已 提交于 2019-12-02 19:11:56
I am using python and I have defined the latitudes and longitudes (in degrees) of a polygon on the map. My goal is to check if a generic point P of coordinates x,y falls within such polygon. I would like therefore to have a function that allows me to check such condition and return True or False if the point is inside or outside the polygon. In this example the point is outside so the result would be False Question : Is there a library/package that allows to reach my goal? if yes which one do you recommend? would you be able to give a small example on how to use it? Here is the code I have

Polygon does not close in Shapely

纵然是瞬间 提交于 2019-12-02 11:50:40
问题 When creating a polygon using the Shapely, I push 4 vertices in the the polygon function. The output should be a tuple with 5 elements (the first vertex is doubled, and described as the last one too). It seems, however, that the order of the input vertices I pass to the function has impact the result: sometime the polygon is described with 5 vertices (as it should) and sometimes with 4 - meaning, it`s not a closed polygon (or in other words - it is not a polygon at all) It must be some bug.

Setting up Shapely on AWS Lambda Python functions

拈花ヽ惹草 提交于 2019-12-02 08:44:45
问题 I have a tried to setup Shapely on AWS Lambda but was getting the below error always. module initialization error: Could not find lib geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so', '/usr/lib/libgeos_c.so']. Not sure how to build shapely in this case. Have built my package on Linux instance and have used the same for deployment purpose. 回答1: If you wish to build your own Lambda compatible binaries for use in your Deployment packages, AWS states the AMI needed to build

Find shortest path from one line to other in Shapely

人盡茶涼 提交于 2019-12-02 07:52:34
问题 Given two lines line_a and line_b , how do I find the pair of points that represents the smaller route from line_a to line_b ? 回答1: Unfortunately, there is no shapely operation to do this. I was thinking about this problem when was asked to extend the solution in the question find-coordinate-of-closest-point-on-polygon-shapely , to handle two polygons. The answer depends on geometry theorem that is intuitively true (although a formal proof requires some calculus and it is a little long to be

Find shortest path from one line to other in Shapely

帅比萌擦擦* 提交于 2019-12-02 06:44:40
Given two lines line_a and line_b , how do I find the pair of points that represents the smaller route from line_a to line_b ? eguaio Unfortunately, there is no shapely operation to do this. I was thinking about this problem when was asked to extend the solution in the question find-coordinate-of-closest-point-on-polygon-shapely , to handle two polygons. The answer depends on geometry theorem that is intuitively true (although a formal proof requires some calculus and it is a little long to be written here without LaTex). The theorem tells: The minimum distance between two line strings that do

Polygon does not close in Shapely

孤街醉人 提交于 2019-12-02 06:29:28
When creating a polygon using the Shapely, I push 4 vertices in the the polygon function. The output should be a tuple with 5 elements (the first vertex is doubled, and described as the last one too). It seems, however, that the order of the input vertices I pass to the function has impact the result: sometime the polygon is described with 5 vertices (as it should) and sometimes with 4 - meaning, it`s not a closed polygon (or in other words - it is not a polygon at all) It must be some bug. In the following example, the only difference between poly1 and poly 2 is the order of the vertices I

Setting up Shapely on AWS Lambda Python functions

旧城冷巷雨未停 提交于 2019-12-02 05:29:07
I have a tried to setup Shapely on AWS Lambda but was getting the below error always. module initialization error: Could not find lib geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so', '/usr/lib/libgeos_c.so']. Not sure how to build shapely in this case. Have built my package on Linux instance and have used the same for deployment purpose. If you wish to build your own Lambda compatible binaries for use in your Deployment packages, AWS states the AMI needed to build them here: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html I have created an EC2

centos libgeos repository missing

萝らか妹 提交于 2019-12-01 18:59:00
On centos 7.3 minimal trying to install shapely or geopandas requires access to https://github.com/libgeos/libgeos libgeos. Trying to install this via sudo yum install libgeos-dev tells me that this package is not available. It seems that I am lacking a repository. So far I have been unable to find a working one as http://trac.osgeo.org/geos is pointing to https://yum.postgresql.org/repopackages.php#pg96 for the RPM but still after rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm the installation candidate is not found. It seems