Skip to main content

Questions tagged [shapely]

Shapely is an open source Python package for construction and analysis of 2D planar geometric objects common to geographic information systems.

4 votes
2 answers
337 views

With GDAL 3.12.0dev-c93ac7701e7c5b3b5537598f2dea1e8a382cc81a, released 2025/08/08 I can extract some invalid unclosed rings in a shapefile, but I cannot get GeoPandas to extract them. In order to play ...
swiss_knight's user avatar
  • 11.5k
2 votes
1 answer
163 views

I've come across both geopandas.GeoSeries.is_valid_reason and shapely.validation.explain_validity, and I'm wondering if they are the same (i.e. if the same checks / the same code is executed under the ...
swiss_knight's user avatar
  • 11.5k
2 votes
1 answer
237 views

Problem I have a polygon dataset containing many features with holes of various sizes. For my downstream modeling workflow, I need polygons without any holes. The challenge is to remove these holes ...
LeKo's user avatar
  • 21
1 vote
0 answers
81 views

I have a script that performs post-processing on a large AOI by filtering shapefiles of points, lines, and polygons using buffers and area thresholds. While the logic works fine, the execution time is ...
SaFaL's user avatar
  • 67
1 vote
1 answer
148 views

I am working in python using geopandas and shapley. Conceptual Description: I have a shapefile of points and a shapefile of lines, in my case a road network. For each point, I would like to identify ...
eigenvector's user avatar
3 votes
2 answers
234 views

I have a dataframe of linestring geometries and would like to merge all the linestrings that touch and intersect into a clusters of unified geometries, with all isolated lines remaining the same. To ...
Esh01's user avatar
  • 33
0 votes
1 answer
166 views

I have written a small Python script that takes a KMZ line and creates a region boundary. This region is then used to import shapefile data that falls within the created boundary. I want to then ...
Nicolas Alexander Lomas's user avatar
0 votes
1 answer
119 views

I want to group the points by userid then create a LineString for each userid. Here's the GeoDataframe: My goal is to store the results in a Geodataframe. Here's the code which I actually obtained ...
mfirdaus_96's user avatar
1 vote
1 answer
125 views

I have a 3D GeoDataFrame (GeoPandas 1.0.1) that I'd like to extract the 3D centroid from. Currently, this is not working because it drops the 3rd dimension: from shapely.geometry import Point import ...
swiss_knight's user avatar
  • 11.5k
0 votes
1 answer
45 views

I need to transform a GeoSeries with another vector of transformation of the same length. For example I can do the following: before = gdp.GeoSeries([box(0, 0, 1, 1), box(10, 10, 11, 11)]) after = ...
hugz's user avatar
  • 3
2 votes
0 answers
48 views

I have a MultiPolygon in Shapely which potentially might have millions of Polygons. I need to find out if such a MultiPolygon has any self-intersection - I don't need to find the intersection itself, ...
joao.dgg3d's user avatar
2 votes
1 answer
204 views

If two Polygons have partly overlapping sides, a union of these Polygons is a Polygon with collinear sides/vertices. Is there a method to merge those sides by deleting the middle vertex? I thought ...
Michal's user avatar
  • 23
2 votes
2 answers
470 views

I have a geodataframe (download link) that contains the geometry of bus lines. It is a Multilinestring. I need to transform the geometry into a single Linestring. My first idea was to use .explode (...
Daniel AG's user avatar
  • 145
6 votes
1 answer
176 views

I have two GeoPandas GeoDataFrames; one containing Polygons, and the other LineStrings: Corresponding sample data: import geopandas as gpd from shapely.geometry import Polygon, LineString gdf1 = gpd....
swiss_knight's user avatar
  • 11.5k
1 vote
1 answer
56 views

I've got a geopandas (EPSG:4326) that when I plot, this is the result (a road intersection): What I'm trying to achieve is to "trim" these geometries around the center of the intersection. ...
Paulo Henrique PH's user avatar

15 30 50 per page
1
2 3 4 5
64