FAQ Database Discussion Community


Python, Shapely: what is the difference between Polygon.contains and Polygon.within?

python,polygon,shapely
The Docstring says: Polygon.contains Returns True if the geometry contains the other, else False Polygon.within Returns True if geometry is within the other, else False How are they different?...

Ubuntu, Anaconda: Cannot import python shapely package

python,ubuntu,importerror,anaconda,shapely
Shapely Import problem Related to MAC OS X I installed shapely using sudo apt-get install python-shapely. I am using Python 2.7.8 |Anaconda 2.1.0 (64-bit)| with ubuntu 14.04 LTS (64 bit) After successful installation, when I try to import it from ipython it gives me an import error. ImportError: No module...

How to create polygons with arcs in shapely (or a better library)

python,shapely
I am trying to use shapely to identify the area used by a shape and the area used by the tools that will cut it on a CNC router. The shape is imported from a dxf drawing using ezdxf. The tool paths can be either rectangles (if they are cut...

Python - Getting attributes from Line contained in a MultiLineString shapefile that intersects a Polygon

python,polygon,shapely,multilinestring
I have 2 shapefiles, 1 containing a lot of lines that make up a road network, and another with many GPS points. So far I've managed to open both shapefiles and do an intersection() using Shapely and Fiona, using the code found here - http://gis.stackexchange.com/a/128210/52590 Here's a copy of my...

test if geometry items intersects in python list

python,shapely
I have one list of data as follows: from shapely.geometry import box data = [box(1,2,3,4), box(5,6,7,8), box(1,2,3,4)] codes = ['A','B','C'] The list 'data' has following elements: A = box(1,2,3,4) B = box(5,6,7,8) C = box(1,2,3,4) I have to check if an element intersect with any other elements. If intersects, they...

Shapely LineString SVG Error

python,svg,shapely
I am trying to learn Shapely and I ultimately would like to take a series of x,y coordinates and create an offset or parallel line. I previously posted a question on this process last night and realized it may have been confusing, so let me restate it and try to...

multiple iteration of the same list

python,python-2.7,python-3.x,numpy,shapely
I have one list of data as follows: from shapely.geometry import box data = [box(1,2,3,4), box(4,5,6,7), box(1,2,3,4)] sublists = [A,B,C] The list 'data' has following sub-lists: A = box(1,2,3,4) B = box(4,5,6,7) C = box(1,2,3,4) I have to check if sub-lists intersect. If intersect they should put in one tuple;...

How to create a Polygon given its Point vertices?

python,polygon,shapely
I want to create a polygon from shapely points. p1 = Point(0,0) p2 = Point(1,0) p3 = Point(1,1) p4 = Point(0,1) pointList = [p1,p2,p3,p4,p1] poly = Polygon(pointList) gives me an type error TypeError: object of type 'Point' has no len() How to create a Polygon from shapely Point objects?...

Finding the distance of a coords from the begning of a route in Python

python,geospatial,shapely
I have a list of coordinates (lat/lon) representing a route. Given a certain radius and another coordinate I need to check if the coord is in the route (within the given radius from any point) and it's distance from the begning of the route. I looked at shapely and it...