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
-1
votes
1 answer

How do I can check if a point is in inside a polygon? - I think existing Library have some problem

I have a question I used two different library import matplotlib.path as mplPath point = (0.3, 0.2) poly = [(0, 0), (0, 1), (1, 0), (1,1)] polygon = mplPath.Path( np.array(poly) ) print(polygon.contains_point(point)) return: False from…
-1
votes
1 answer

AttributeError: 'LineString' object has no attribute 'encode'

I am trying to convert data frame to geodata frame where data frame geometry applying for wkt.loads to convert geometry Line String to geodata frame but getting below error: text = text.encode('ascii') AttributeError: 'LineString' object has no…
Rtop
  • 59
  • 5
-1
votes
1 answer

RecursionError: maximum recursion depth exceeded in comparison while working with pandas

I am working with some geodata. I want to get a point object from the latitude and longitude that I already have. My code looks as follows: for i in range(len(map_polygon)): x = map_polygon.at[i, 'lon'] y = map_polygon.at[i, 'lat'] …
-1
votes
1 answer

Shapely prints a picture of points instead of coordinates

I am trying to create a script that identifies the closest point on a line to point. I did a lot of research and landed on the shapely module to complete this. I use the example code from shapely.geometry import Point, LineString from shapely.ops…
Jake
  • 303
  • 5
  • 19
-1
votes
1 answer

How to create a shapely.geometry.box from a sets of sublist inside a list?

I have a list of coordinates as follows: zip_box = [(10.0, 20.0, 20.0, 30.0), (28.0, 40.0, 38.0, 50.0), (46.0, 60.0, 56.0, 70.0), (64.0, 80.0, 74.0, 90.0), (82.0, 100.0, 92.0, 110.0)] They are organized as: (minx, miny, maxx, maxy). How can I…
alex
  • 3
  • 2
-1
votes
1 answer

Save Tuple Containing Polygon Coordinates to Shapefile Using Geopandas

I'm having trouble converting a tuple containing the coordinates of polygon vertices to a shapefile. Tuples are a very unfamiliar format to me; if it were in a dataframe, I could do it easily with geopandas. shape= ({'type': 'Polygon', …
EHB
  • 1,127
  • 3
  • 13
  • 24
-1
votes
1 answer

Define points within a polygon

I have a list of customers lat and long and I want to define which ones are within a given polygon. But the results I got are none of them in that polygon and it is not correct. Could you please help? Thanks! from shapely.geometry import…
-1
votes
1 answer

What is a non-simple shapely Polygon?

from shapely.geometry import Polygon, MultiPolygon, mapping from shapely.ops import cascaded_union polygon = Polygon([(0,0), (0, 1), (1, 1), (1, 2)]) polygon.is_simple gives True. But the description/documentation is: True if the geometry is…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
-1
votes
1 answer

Detect values in bathymetry grid and output polygons - Python

I have been supplied with a matrix of bathymetry (water depth) data. The matrix represents an evenly spaced grid of depths, and is in .csv format. The matrix has some 'screened out' areas which have value -9999. The -9999 points need to be…
Hamo
  • 99
  • 2
  • 11
-1
votes
1 answer

finding point in polyline - python

I have a shape file for road names - which is actually polyline geometry. And I also have address points, I am trying to find the road name of each address point using the polyline shape file. Is there a way to work out this? I used spatial join,…
ds_user
  • 2,139
  • 4
  • 36
  • 71
-1
votes
2 answers

TypeError: __init__() takes exactly 4 arguments (3 given) Point Shapely

I am trying to write a program to create lines and points using shapely, somehow when I try to create a point from a Linestring I get the following error, and this persists even if I put in integer numbers: I get the following error for my…
LoveMeow
  • 3,858
  • 9
  • 44
  • 66
-2
votes
1 answer

Obtain coordinates of a Polygon / Multi-polygon around a point in python

I am using plotlys scattermapbox to draw a polygon around a point object. I'd like to draw a polygon that covers 'x' mile radius from a POI. I found this that is helpful: https://plotly.com/python/filled-area-on-mapbox/. However, in my case I need…
kms
  • 1,810
  • 1
  • 41
  • 92
-2
votes
2 answers

Python Error - 'str' object has no attribute '_geom'

I am using shapely to convert longitudes and latitudes contained in a CSV to WKB format. For context, the CSV is parsed using a python AWS Lambda code. The format of the file being parsed is as…
-2
votes
1 answer

Definite points in zones and got an error ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

I have a list of customers lat and long and I want to define which ones are within given a list of zones or polygons. from shapely.geometry import Polygon from shapely.geometry import Point import pandas as pd from shapely.wkt import loads import…
-2
votes
1 answer

Shapely Polygon intersect in order Python

I have 2 list of Polygon as below: list1 = [p1, p2, p3] list2 = [pa, pb, pc] I want to check if p1 overlaps pa, p2 overlaps pb, and p3 overlaps pc. I used shapely.intersects to check whether they overlap with each other. But I don't know how to…
Windy764
  • 77
  • 7
1 2 3
74
75