Questions tagged [shapely]

PostGIS-ish operations outside a database context for Pythoneers and Pythonistas.

Shapely is a BSD-licensed Python package (see Shapely · PyPI) for manipulation and analysis of planar geometric objects. It is based on the widely deployed GEOS (the engine of PostGIS) and JTS (from which GEOS is ported) libraries. This C dependency is traded for the ability to execute with blazing speed. Shapely is not concerned with data formats or coordinate systems, but can be readily integrated with packages that are. For more details, see the Shapely manual.

1113 questions
0
votes
1 answer

to_shape() fails with ParseException

I have been experimenting with GeoAlchemy2, and I have some trouble with parsing its geom field. I have tried to use the built-in to_shape function on a WKB element: The example reads: lake = Session.query(Lake).get(1) polygon =…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
0
votes
1 answer

Find the intersection between three cycles (or more) with Shapely

In Shapely's tutorial there is a nice example (illustrated bellow) on how to find the intersection between exactly two points: a = Point(1, 1).buffer(1.5) b = Point(2, 1).buffer(1.5) a.intersection(b) a.union(b) What it doesn't say though is how to…
user706838
  • 5,132
  • 14
  • 54
  • 78
0
votes
1 answer

'Polygone' object does not support indexing

I am trying to render an SVG map using Kartograph.py. It throws me the TypeError. Here is the python code: import kartograph from kartograph import Kartograph import sys from kartograph.options import read_map_config css =…
user343
  • 21
  • 8
0
votes
2 answers

need help creating layer with geom type wkbGeometryCollection

I am having trouble creating a layer with geom type as geometry collection. Thus I am unable to output to a shapefile. I have attached code below. dstLayer is null. This does not happen if geom type is polygon or multilinestring or any…
sushmit sarmah
  • 7,508
  • 6
  • 21
  • 24
-1
votes
1 answer

Render Shapely polygon intersecting with the date border correctly

I have got a shapely polygon given in WGS84 coordinates formed like shown in the picture. As you can see, it intersects the date border. When I get the polygon into a shapely polygon the coordinates are getting connected the wrong way and the…
-1
votes
1 answer

how to revert unary_union() in python

I have some polygons with their respective coordinates on which i used uniary_union(). All the polygons are now become one. Now that big polygon has a group of polygons that are connect with each other. I want to know, how to find the max number of…
-1
votes
1 answer

Convert a polygon into pandas dataframe with multiple rows

I have this pandas dataframe which I converted from a polygon( with latitudes and longitudes).I need to separate this into rows (each row with one lat and long pair). Can anyone please help. Thanks. I just need an index and evert lat-long pair in…
-1
votes
2 answers

Touch edges two rectangles with shapely

I have two rectangles. One rectangle contains the other. I want to find the length of the segments where they touch each other. I have tried this code but the result is 798 which is wrong because the result I am looking for is 399. from…
AIpython
  • 3
  • 2
-1
votes
1 answer

How to detect inner polygons from a multipolygon shapely object?

I would like to detect inner polygons from a multipolygon shapely object. Great lakes, Black Sea and Caspian sea should be inner polygons and not be filled. How to do this properly with shapefile ? Please find the script bellow for…
PBrockmann
  • 303
  • 5
  • 16
-1
votes
1 answer

Shapely Polygons | Calculate Intersection of Union

Goal: Calculate 8 different Intersection of Union area numbers, each concerning the intersection of 3 MultiPolygons. There are 3 sources, each representing the same 8 groups of shapes. Mathematically, my instinct is to refer to the Jaccard…
DanielBell99
  • 896
  • 5
  • 25
  • 57
-1
votes
1 answer

Follium map : my European locations are plotted in Africa

I would like to use Folium map to plot markers. My locations are in France. I have latitude and longitude information. So I create POINT geometry in order to implement them in Folium map. df = pd.read_csv('./data/addresses_geocoded.csv', sep = ';',…
user16313671
-1
votes
2 answers

Calculate intersected distance across polygons between two points

I have shape files including all the coordinates (lat, long) of different polygons, for example the black, red, and green shown here. I would like to calculate the distance that the AB line across different polygons. I am using geopandas and also…
athlonshi
  • 1,711
  • 1
  • 19
  • 23
-1
votes
1 answer

How do I determine if a lat/long point is within a polygon?

I have a shapefile of all the counties that make up my state. Using the shapefile (which contains geometric for the district polygons) I was able to use geopandas to plot the shapes in a figure. I have some addresses that I have geocoded into…
-1
votes
1 answer

How to find the area of a partially closed shape with discreate data points

I tried to apply shapely, But even after reading the documentation, I wasn't really successful. I tried for another answer. Area inside a closed loop curve in python My implementation was like this. from shapely.geometry import Point i =…
get2anc
  • 41
  • 6
-1
votes
1 answer

How to create a coordinate pair

Have a list of coordinate pairs based on the provided longitudes and latitudes and I want to store the list in a variable coordpairs. I try using the code below. When I checked the coordinate pair I only get the value for the longitude. for x in…