Questions tagged [shapely]

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

Shapely is a BSD-licensed Python package 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:

740 questions
-1
votes
3 answers

Path Connecting Points without overlapping in Python

I want a Path connecting points like this: enter image description here From what I have tried this is the results I was able to achieve in Python: enter image description here Looks Fairly simple. Is it possible?
-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
  • 143
  • 4
  • 13
-1
votes
1 answer

How to associate closest line to every given point in Python?

I have two Pandas DataFrames, the first one is named Points with columns 'longitude' and 'latitude' (i.e. geocoordinates); and, the second data frame is named Links with these columns: 'lon1' & 'lat1' for the first point and 'lon2' & 'lat2' for the…
Alben
  • 76
  • 5
-1
votes
1 answer

How to crop polygon to be within a rectangular region

So I have a numpy polygon array of shape (N, 2) that I want to crop such that it is within the bounds of the 256x256 image seen in 1. That is, I want to crop this polygon such that it matches with the boundaries of the yellow mask inside the 256x256…
jlcv
  • 1,452
  • 2
  • 20
  • 37
-1
votes
3 answers

Turn geometry column into lat/long columns in Geodataframe

I have a Geodataframe with a 'geometry' column in which I have point geometries, e.g. POINT (-0.01334 51.52883). I need to extract the latitude and longitude and add it as new columns in the dataframe. I tried using df['lon'] =…
-1
votes
1 answer

python - Error calculating length in LineString objects

Currently dealing with two errors while programming the code shown below, I was wondering if anybody could help me or give some tips to solve them, thank you. 1) When trying to assign multiple LineString objects to a MultiLineString object I…
rclee
  • 50
  • 8
-1
votes
1 answer

Create new shapely polygon by finding the overlapping area

I have two polygons the red one and yellow one obtained from osm map. I want to extract the overlapping area as a polygon. pol.intersects(pol2) shapely gives the coordinates of only the red line. but i want to get the whole overlapped area as…
Faisal
  • 130
  • 10
-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
  • 91,837
  • 114
  • 489
  • 768
-1
votes
1 answer

Given a geographical coordinate in U.S., how to find out if it is in Urban or Rural areas?

Given a geographical coordinate in U.S., how to find out if it is in Urban or Rural areas? I have about 10000 geographical coordinates all in the U.S., and I want to use Python + basemap to find out if a point is urban or rural. I'm not sure which…
Ash
  • 2,988
  • 28
  • 36
-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
  • 69
  • 8
-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
  • 1,899
  • 2
  • 25
  • 61
-1
votes
1 answer

Intersect two shapely polygons on the Earth projection

as i know, shapely use only cartesian coordinate system. I have two point on the earth with lat and lon coordinates. I need create buffer with 1km radius around this two points and find polygon, where this buffers intersect. But construstion…
-2
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
-2
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
  • 853
  • 2
  • 10
  • 21
1 2 3
49
50