Tag Info

New answers tagged

1

Then I put every record in the rows of a pandas.DataFrame Why ? If you only want to copy the original attributes (LineString) to the new shapefile (Points), after computing the centroid, you don't need Pandas: import fiona from shapely.geometry import shape, mapping with fiona.open("polyline.shp") as input: # change only the geometry of the ...


2

With your example, polygon is a standard Python dict object that represents a GeoJSON geometry, which only uses standard data types, with no fancy geospatial properties. But you can convert polygon into a shapely geometry, as you have done with shape polygon = shapefile_record['geometry'] shape = shapely.geometry.asShape(polygon) print(shape.bounds)


5

Some solutions according to the position of an element in a list: polA = Polygon([(0,0), (3,0), (3,3), (0,3)]) polB = Polygon([(2,-1), (5,-1), (5,2), (2,2)]) polC = Polygon([(5,2), (8,2), (8,5), (5,5)]) collection = [polA, polB, polC] Iterating by index: for i in range(len(collection)-1): print collection[i], collection[i+1], ...



Top 50 recent answers are included