0
votes
0answers
17 views

aggregate counts on a grid and determine grid adjacency

So here is the problem I am working on. I have a bunch of lat, long coordinates for event occurrences. I want to create a grid and then count how many points fall into each grid pixel. Once I have ...
0
votes
1answer
24 views

create polygon adjacency matrix using python

I am trying to create an adjacency matrix from a set of polygons. That is, I have a bunch of polygons and I want to identify which polygons have a common edge or "touch" each other. Once I find this ...
2
votes
2answers
49 views

Shapely: Round Polygon Corners?

I use the python module "shapely" to make Polygons (like below). Can I convert the sharp edges of a polygon easily to round edges? Such that when I have unified some polygons I could issue a command ...
1
vote
1answer
47 views

Equivalent function to shapely's envelope in ogr?

I wrote a very simple python function that gives me the envelope/bounding box/...based on two coordinate pairs (ower left and upper right corner): # ... def get_bounding_box(self, ll_corner, ...
3
votes
2answers
139 views

how would one get the end points of a polyline?

I am attempting to write a script to get the end points of a series polylines, and then use those end points to create a polygon. I'm not sure which tools to begin to use on this project. I would ...
1
vote
2answers
63 views

Get the vertices on a LineString either side of a Point

I have a shapely LineString and defined a shapely Point which lies along the LineString. How can I find the vertices of the LineString which lie either side of the point? (split the line in two). ...
1
vote
1answer
49 views

create a pie shaped object in shapely and export to gis polygon object

I would like to create a pie chart-shaped polygon with concentric layers like so: I can create this simple object with: from math import sin, cos, radians from shapely.geometry import ...
5
votes
1answer
137 views

Shapely unable to tell if polygon contains point

For an application I want to determine under which constituency a given coordinate falls. After looking at the various options, I decided upon shapely and fiona as the easiest way to implement this. ...
3
votes
1answer
79 views

Serialize python list containing geometry

In simple case if list doesn't contains geometry all works fine: result = [dict(f.fields, id=f.id, label=f.label) for f in features] json.dumps(result) But if result list contains geometry ...
0
votes
1answer
193 views

Shapely LineString and Polygon intersect?

here is my python code, it does not intersect and when I plot this in google map , I see the intersection. shapely.geometry is in Cartesian plane, how you are solving this? l = "40.65:-114.07 ...
0
votes
1answer
63 views

Shapely Python NameError when using cascaded_union

I am fairly new to Python and therefore my error-solving skills are not much yet developed. I am using Python within a geoprocessing script which is supposed to use ogr (reading/writing shp) and ...
0
votes
1answer
159 views

Finding differences between two shapefiles in Python

I'm trying to find out whether there were any border changes between two yearly shapefiles. I've heard a lot of praise for Python's open source GIS tools like Shapely/Fiona, and thought I would try ...
1
vote
2answers
521 views

Determine if point is within an irregular polygon using Python

I would like to create a mask of a grid where points are evaluated as either 1's or 0's depending on if they lay outside of an irregular (i.e. not rectangular) polygon. I have a set of high-latitude ...
0
votes
1answer
128 views

Calculating intersection between points and polygon in shapefile

I want accomplish the following using command line python tools only (shapely + fiona) I was wondering if there was a straightforward way for me to do the following: Read in a shapefile (all ...
2
votes
1answer
155 views

Fiona - Preffered method for defining a schema

I'm fairly new to the world of python and GIS - so this is definitely a beginner question. I am following Tom Macwrights small guide to Shapely and Fiona, and I noticed that even when opening the ...
0
votes
2answers
225 views

problems with py2exe, shapely and fiona

I have a short python script, called test: import fiona with fiona.open("C:\\Essai_compil", 'r') as l_Obs_shp: for shp in l_Obs_shp: print shp['geometry'] I want to compile with ...
2
votes
2answers
176 views

Does shapely within function identify inner holes?

I have a series of shapefiles that include both polygons and multipolygons. I am using ogr to extract them in wkb, and them I am using shapely to check if a point fall inside a polygon (or a ...
0
votes
0answers
134 views

Computing percentage of similarity between two line strings using python shapely

I'm quite new to shapely, been tinkering with it and I have a necessity to compare two line strings and see what percentage of them overlap. The geographic coordinates come from two different systems. ...
3
votes
2answers
470 views

Creating Shapely MultiPolygons from shape file MultiPolygons

I'm reading a shapefile using Fiona: with fiona.open('data/boroughs/boroughs_n.shp') as source: mpolys = [p for p in source] candidate = polys[0]['geometry'] this gives me a dict containing a ...
1
vote
0answers
121 views

How to shift vertices of shapes in shapefile using FOSS python library?

I need to shift each vertice of shape in a shapefile (of any type:point, line, polygon, multiline etc.) with Python. I need to loop in all shapes, get the vertices, get it's coordinates and for each ...
1
vote
2answers
224 views

Convert 3D WKT to 2D Shapely Geometry

I have the WKT of many linestrings which contains three dimensions, however my script only requires a two dimensional linestring and I therefore want to discard the third dimension. My current code, ...
2
votes
1answer
290 views

How to install shapely on Ubuntu 12.10

I have tried to install shapely on Ubuntu 12.10. Therefore I installed libgeos-c1, pip and shapely with $ pip install Shapely. The shapely files are now in /home/user/build/Shapely. When I try to ...
3
votes
1answer
194 views

Is there an online reference available for the Fiona and Shapely libraries?

Is there an online reference available for the Fiona and Shapely libraries? I'm thinking a real reference, beside the tutorial-style documentation: http://toblerity.github.io/shapely/manual.html ...
1
vote
0answers
221 views

Install shapely for QGIS on Mac

I know there are a number of similar questions, but none of them have answers that allow me to use shapely in QGIS. In particular I am trying to install the Contour plugin, but this fails with the ...
2
votes
1answer
55 views

how to differentiate between common parts of the triangle and extract linestring from it

Can you help me break down shape A to different linestrings: lines 2 & 3 AND line 1? The shape contains three different polygons (A, B, C). I wish to determine the start/end point of each part ...
0
votes
2answers
132 views

Why is Shapely not installing correctly?

I am trying to run Shapely on a new machine, and tried both installing it from source, using the installer on its webpage, and using pip install shapely. Every reference I try to make from the library ...
0
votes
2answers
404 views

How to install Shapely, but got stuck into Python language

I have a MAC OSX 10.7.5 and am trying to learn how to use QGIS. Following a couple of tutorials I came to know I have to install shapely. I followed the instructions by the multi-cited ...
4
votes
4answers
315 views

How to computational efficiently check if there are any overlapping polygons in a group of polygons?

I need to do some processing with groups of polygons. If any of the polygons in the group overlaps other polygon the result is unpredictable and don't throw any error. So, I need to detect if there is ...
7
votes
2answers
720 views

Converting KML files for use with Python library Shapely

I am trying to get a KML-file (wijken.kml) into Shapely. The KML-file is validated against the proper XML schema, so I guess the input is correct. Routes I have tried: 1) Converting to WKT or WKB ...
5
votes
3answers
2k views

How to write Shapely geometries to shapefiles?

Can someone demonstrate a simple way to write geometry data-structures from shapely into shapefiles? I am particularly interested in polygons with holes and linestrings. It would also be beneficial to ...
1
vote
1answer
918 views

QGIS Python version

I have brewed python 2.7.3 onto my Mac (Lion), and installed shapely via pip install shapely. The Polygonizer plugin, however, does not find the shapely library. I see when QGIS loads a Python ...
3
votes
0answers
216 views

Importing matplotlib basemap and shapely

I'm not sure if this is the right place to ask this, but here we go. I have a python script that uses matplotlib's basemap and another part that uses shapely to do an intersection of 2 polygons. If ...
0
votes
2answers
567 views

Python module “shapely.wkb” missing

I am trying to follow a tutorial from here http://qgistips.spatialthoughts.com/2012/12/find-neighbor-polygons-in-layer-in-qgis.html#more I have downloaded the relevant python script and edited it as ...
3
votes
2answers
401 views

Checking if a point is in a circle

I'm using shapely to check if a point is in a polygon, but I also need to check if a point is in a circle. Checking the docs, I don't see how do that... Maybe I could create a circle? circle = ...
5
votes
1answer
230 views

How do you fix Overlapping Lines?

I have a line dataset that contains some lines where the "end points" are actually found in the middle of the line. In the image below, the nodes are shown in green and one of the end points in red. ...
4
votes
1answer
922 views

GEOS and Shapely installation on Windows

When trying to install Shapely on my Windows 64bit computer, I cannot get the GEOS library to work. So far, I have run the OSGeo4W installer from which I installed GDAL (I believe the geos library ...
7
votes
1answer
328 views

How to split two interscting polygons by the average linestring of the shared area (QGIS / python shapely)

I have two polygons, POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5)) POLYGON((1 1, 1 7, 7 7, 7 1, 1 1)) and wish to split them evenly. The result should be a split along the red marked line. I'm using ...
1
vote
1answer
384 views

How do I find out if a given lat lon is in a KML Linear ring using shapely?

I'm a GIS n00b. I have some LinearRings in a KML file that give the areas for a bunch of different regions. And then I (will) have some lat lons that I want to test to see if they're in any of the ...
4
votes
1answer
566 views

Wrap GEOS functionality into python

I've been looking on how to get GEOSExtractLine available in python. I looked into Shapely source to if it was available for it, but it's not. I'm trying to wrap this funcionality into Django, much ...
5
votes
2answers
773 views

Python: How to export Shapely objects to DXF file

Using shapely package for Python how to export the resulting shapely objects such as buffer to a DXF file?
4
votes
1answer
595 views

Find distance and heading from a point to a polygon in lat, lon coordinates

I have counties mapped using polygons in Shapely with latitude/longitude for coordinates. Given a complex polygon x and single point y, how would I find the shortest distance between x and y as well ...
5
votes
5answers
1k views

Python, shapely library: is it possible to do an affine operation on shape polygon?

I am trying to create a rotated rectangle in lat/lon coordinates. Basically I have the coordinates of the center and rotation angle around the center. Is it possible to do using, shapely or gdal, or ...
8
votes
1answer
1k views

Polygon overlay with Shapely

I'm trying to capture all the non-overlapping polygons indicated below using Shapely (given polygons A,B & C). Moreover, I'm hoping to do so without iteration, testing for intersect etc. The ...
20
votes
2answers
2k views

Python Efficiency — Need suggestions about how to use OGR and Shapely in more efficient way

I'm looking for some suggestions about how to make my python code more efficient. Normally efficiency doesn't matter for me but I am now working with a text file of US locations with over 1.5 million ...
2
votes
3answers
484 views

Why is this polygon “self intersected” and invalid?

I have a polygon defined as follows: segment from 43:29:02 N 003:50:39 E to 43:34:12 N 003:43:04 E arc(CW): center (43:34:49 N 003:58:16 E) from 43:34:12 N 003:43:04 E to 43:45:45 N 003:59:56 E ...
4
votes
1answer
394 views

How to deal with direction (CW, CCW) of circles, in particular with shapely?

I am translating an input that describes zones by mixing segments and arcs. Arcs are given by a center, 2 points (beginning/end of arc) and a direction (CW or CCW). In a first prototypes using GDAL, I ...
9
votes
4answers
5k views

using shapely: translating between Polygons and MultiPolygons

[EDIT: the solution to this was simply to use OGR to read shapefiles. See geographika's example.] In an ESRI shapefile, there is no distinction between Polygons and MultiPolygons. Furthermore, there ...