Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects.

learn more… | top users | synonyms

3
votes
2answers
143 views

Can this Be Recoded to Be More Efficient with Respect to Processing Time?

I'm very new to GIS but have been asked to parse through any given ESRI GDB file-folder without using any ESRI product. I've been trying to focus on using Fiona and Shapely as these seem to be ...
0
votes
0answers
23 views

How to do a Python / Fiona / Shapely equivalen to an ESRI ArcPy SpatialJoin?

I'm a GIS noob, but I am trying to learn as quickly as I can. Please bear with me. How can I identify what structures from one layer are WITHIN in some body of water in another layer? My problem ...
1
vote
1answer
31 views

How to Parse Through a ESRI GDB File/Folder After Opened with Fiona?

I should point out that I'm a noob. I'm playing around with making a python gui app and believe I have opened an ESRI GDB file/folder using: with fiona.open(GDBPath, 'r') as sourceGeoData What I'd ...
0
votes
1answer
48 views

Check if point is within radius of another point with Shapely

I've successfully used Shapely with python to check if a point is within one of a set of polygons in a .shp file but now would like to check if a point is within a circle of radius x miles from ...
2
votes
1answer
34 views

How to create a Null shape in shapely

I want to create a valid Shape object in shapely which has properties but has no geometry. e.g. For creating features to be saved into a shapefile. All features have attributes/properties but some ...
1
vote
1answer
58 views

Assign a point to polygon using pandas and shapely

I have a series of Easting and Northing coordinates in pandas dataframe along with other columns of information. I know the coordinates fall within and administrative area and want to match the ...
2
votes
1answer
57 views

Get intersection of circles shapely

I have a List of Points which I transform to circles. Code from here circles = [Point(random.random(), random.random()).buffer(random.random() * 0.1) for i in range(3)] I want to know which circles ...
0
votes
2answers
41 views

Trouble getting shapely to run

I downloaded the GDAL complete Framework von Kyngchaos which also includes the GEOS Framework and shapely for python. I can import shapely without a problem, but when I try to perform some "geo ...
1
vote
2answers
70 views

Is it possible to round all coordinates in shapely?

Following on from How can I add points to a LineString in shapely?, I'm hitting a problem where floating point representations mean objects aren't precisely where I expect them be after they are moved ...
2
votes
1answer
42 views

Add SRID to Point

When inserting a point into a PostGIS database I do it using ST_GeomFromText('POINT(0 1 2)',26918). Note that this was done on a tutorial database where the SRID was set manually as explained ...
0
votes
1answer
34 views

How can I add points to a LineString in shapely?

I have two Polygons which intersect along one edge as shown below. I need to add the red vertices at each end of the intersection to the blue polygon. I thought I could do this with by calling ...
1
vote
1answer
50 views

How to simplify borders between polygons in shapely?

I have some fairly complex, and not completely accurate shapes stored as shapely Polygon objects. I'm trying to find the common borders, which should be as easy as finding the LineString returned from ...
1
vote
1answer
38 views

How to find the area with most intersection for buffer regions?

Find the area with the most intersection This question relates to previous question asked - How to find the intersection areas of overlapping buffer zones in single shapefile?. I tried to ...
1
vote
2answers
102 views

How to polygonize raster to shapely polygons

I am seeking an open-source python solution to convert raster to polygon (no ArcPy). I did know the GDAL function to convert raster to polygon, and here is the manual: ...
0
votes
0answers
46 views

cartopy: plotting shapefiles

I am new to gis and am trying to plot a shapefile containing land polygons. (From OSM.) Unfortunately my output image is always empty (i.e. white). Can somebody tell me what I am doing wrong? import ...
2
votes
1answer
112 views

How to find the intersection areas of overlapping buffer zones in single shapefile?

Find the intersections of the buffer zones I found an example where they tried finding the intersection of two different shapefiles -Intersect Shapefiles using Shapely. I've tried to adapt my code to ...
2
votes
2answers
189 views

Shapely Distance different from Geopy/Haversine

I am running a specific analysis where we use shapely to create buffers around points (store locations) and then check if other points (user locations) are present within that buffer value. When i ...
2
votes
3answers
106 views

I have an existing attribute table that I'd like to add values to the fields within it while preserving the geometry, how can I do this?

I've tried to use fiona and shapely and ogr, but the tutorials seem to be insufficient to describe how to do such a seemingly simple task. In arcpy this could be done simply with an update cursor. ...
0
votes
1answer
62 views

How to access members of GeometryCollection - Python

I am using 'intersection' function from Shapely to find junctions of a road network. As i found, intersection returns GeometryCollection. In my case it could be Point, LineString or perhaps ...
1
vote
1answer
68 views

Difference between Crosses & Intersects - Shapely (Python)

I have two questions : I have some lines (eg: road network). I want to find coordinates of each junction. Should i use crosses or intersects function from python's Shapely module? They are giving ...
7
votes
2answers
103 views

Polygons across international dateline [-180..+180 longitude]

I'm trying to generate polygons for satellite orbital swaths. So far I have a method to generate two lines which represent the edge of each swath in [lat,long]. Some of the swath's cross the ...
0
votes
1answer
43 views

importing fiona before shapely raising geos-related OSError

I ran into an issue where the order of imports for fiona and shapely caused the following geos error below which happens when i import fiona before shapely. If I do the reverse all is fine. Must be ...
2
votes
1answer
77 views

Converting Shapely MultiPolygon to Polygon: Technique doesn't always work

In order to get the exterior coordinates I need to convert a shapely MultiPolygon to a Polygon. I do it like this: if poly.geometry.type == 'Polygon': x, y = poly.geometry.exterior.xy elif ...
0
votes
1answer
62 views

Cut a linear feature according to the directions or azimuths

I have a shapefile linear that contains a single items as in the image and I want to divide it into several section respecting the azimuth and the line direction. i have this code : import os ...
5
votes
2answers
238 views

intersecting two shapefiles from Python or command line

I'm new to working with geo data and trying to address a similar question to the one posted here. Using command line and/or shapely/fiona, in the most efficient and elegant way. I created two ...
1
vote
0answers
48 views

How do I create a raster file from a geopandas dataframe storing lats, longs, values, and geometries

From a text file with time, lat, long, and cf values, I create a pandas dataframe (cf_df). Then I use the lat, long values to create a geoseries and create a geopandas dataframe from the original ...
0
votes
0answers
10 views

Converting branched multiline into series of single lines in shapely

If I have a multiline string representing a branched network with a common starting point (red network in pic below): Does anyone know how to convert this to a set of individual single linestrings ...
2
votes
0answers
48 views

Interpolating every X distance along line in shapely

If I have a shapely multiline object that contains many lines whose total length each is 50km (when traced from the origin), and I want to interpolate along the multiline every X meters (let's say ...
1
vote
1answer
104 views

fiona ValueError: invalid literal for int() with base 10: 'str'

Why below code does not work- import fiona from fiona.crs import from_epsg my_schema = {'geometry': 'Point', 'properties': {'mean_in': 'str', 'total_h1': 'str', 'total_h2': 'str', 'LOS': 'str', ...
0
votes
0answers
66 views

Using shapely and geopandas in pyspark

I'm new to geospatial analysis and trying to start the analysis using python. Since the data is too huge we are trying to make use of hadoop and spark to get the analysis done. I would like to use ...
0
votes
2answers
37 views

Shapely Not Determining Point in State

I am pulling State geometry data from a database (populated from Shapefiles) to find what state a coordinate pair is in. I was originally using GeoAlchemy, but tens of thousands of queries to ...
8
votes
3answers
189 views

“Greedy” clipping lines with polygon

I am wishing to clip a set of polylines (black lines in image below) to the outer boundary of a polygon. Any voids within the polygon should be ignored. My ideal output are the dashed yellow lines. ...
1
vote
0answers
82 views

Projecting GeoJSON polygon object in python to calculate area

I have a script, written in python, that does many calculations - but one set of calculations hinges on determining the area of a polygon that I read in, in GeoJSON format. I can convert this object ...
0
votes
2answers
277 views

Point in Polygon - geojson - using Shapely / Python returning incorrect results

I'm trying to test if a point is inside a polygon using this example: http://stackoverflow.com/questions/20776205/point-in-polygon-with-geojson-in-python However, my output says that none of the ...
0
votes
0answers
56 views

Intersect using Open Source GIS [duplicate]

I have a CSV containing user locations (has lat, long, userid, timestamp). I have a countries shapefile (has country name, geometry - got this from thematicmapping.org). I am trying to append a ...
4
votes
0answers
26 views

“Merging” 2 layers of LineString with splits at intersections

I would like to "merge" 2 networks of lines and these lines need to be split when they intersect. With pictures it should be clearer : What to do: if a black line intersects a red line, they ...
0
votes
0answers
93 views

Calculating distances with lat/long in decimals and WGS 84

I need to calculate the distance between points of two different datasets, once with locations of towns, the other with locations of dams. Both are located in different countries in Africa. The more ...
3
votes
1answer
79 views

When validating geometries, what are “Nested shells”?

I am validating shapefiles polygon geometry using shapely, and have also attempted it using FME. Some polygons return the error "Nested Shells". I cannot find a definition of what the problem is, ...
1
vote
0answers
78 views

Error and kernel dies with shapely/geos inside Jupyter notebook

I have a Python 2.7 script (code below) that scrapes data from a table on the web and draws a map. It runs fine from the command line using $ python bears.py When I run the identical script from ...
1
vote
1answer
77 views

How to split epsg 4326 linestring in parts consisting of given length in meters in python?

I want to know linestrings (epsg:4326) length in meters instead of degrees. I know that I can use proj4 for that. Here is my code, if you interested. project = partial( pyproj.transform, ...
1
vote
0answers
58 views

Creating spatial layer from MS SQL Server table?

I have a table in MSSQL that I am trying to use to create a spatial layer from using the QgsVectorLayer function to load the table as a layer, and then using Fiona to create a shapefile but I am ...
-1
votes
1answer
86 views

fiona writing geometry into shapefile problem [closed]

Context: I use lxml library that generates some dictionary (infact it is xml attribute dictionary) from xml and i am trying to write these into a shapefile-i.e. get one element-attribute from xml ...
3
votes
1answer
147 views

What is Shapely library alternative in R?

I want to manipulate 2D geospatial geometries in R. I am used to using Shapely in Python but I am a newbie in R. Can you suggest Shapely alternatives for R?
1
vote
1answer
424 views

GeoPandas: return lat and long of a centroid point

I would like to return the lat and lon or x and y from the point object in the following series as I plan to link them with an API I built that links OSM and NetworkX. The centroids will be added as ...
4
votes
2answers
348 views

geopandas/shapely: what units it uses/calculates for area and distance functions?

it looks like a silly question, yet I can't find clear answer on that: what units geopandas/shapely use calculating distance/area between objects?
0
votes
2answers
214 views

Python buffer points and clip with line-segment (OS Open Roads in BNG) [duplicate]

I have an array of points (in latitude, longitude coordinates) which I would like to buffer and dissolve (into a polygon) and then intersect the Ordnance Survey Open Roads (projected in BNG) with that ...
5
votes
0answers
139 views

Counting features into intersections of Shapely Polygons

I have a geopandas GeoDataFrame containing hundreds of shapely Polygon and MultiPolygon geometries. The polygons overlap in lots of places. I'd like to make a new geometry that contains a count of how ...
1
vote
1answer
69 views

Points to irregular grid

I have a huge dataset (millions of points) and a irregular grid (quadtree) in shapefile format and I need to convert the points in countes over the grid provided. I managed to make it work, using ...
2
votes
2answers
70 views

How to successfully do “nested” looping over a Fiona collection

I wrote some code that basically loops over all features in a shapefile with Fiona in Python, doing some things, calculating some things, etc. I found that it would exit the for loop prematurely, ...
3
votes
1answer
181 views

QGIS Contour Plugin Says No Shapely; can import shapely in QGIS console

I'm keen to create some contours (isochrones for a pedestrian 'ped-shed' catchment) from a point dataset in QGIS, using the contour plugin from the Plugins repository. I installed the plugin, but ...