New answers tagged

0

Using the answer above (http://gis.stackexchange.com/a/197780/62250) I modified it to work with different crs and calculate the length of the intersection borders: import fiona from shapely.geometry import shape, mapping import itertools # load the shapefile as an iterable polys = fiona.open("polygons.shp") Writing the shapefile: newschema = {'geometry': ...


3

As Fiona works with dictionaries, it is easy. With the example of Finding the common borders between polygons in the same shapefile import fiona from shapely.geometry import shape, mapping # load the shapefile as an iterable polys = fiona.open("polygons.shp") Now, with the itertools module: import itertools for pol1,pol2 in itertools.combinations(...


1

It is a pure Python problem With shapely, your 3D point is represented by pt3D = Point(11.52951677300007,0.7729100360000416, -50000) list(pt3D.coords) [(11.52951677300007, 0.7729100360000416, -50000.0)] Using slicing for example (there are others solutions) pt2D = Point(list(pt3D.coords)[0][:2]) print pt2D POINT (11.52951677300007 0.7729100360000416) ...


0

I show you here a simple example of the use of bounding boxes in a spatial index (intersection of two polygon shapefiles) 1) load the shapefiles import fiona from shapely.geometry import shape blue = fiona.open("poly1.shp") green = fiona.open("poly2.shp") 2) create a spatial index with the bounding boxes of the blue layer (you can use rtree, pyrtree (...



Top 50 recent answers are included