Hot answers tagged

7

Use the ogr2ogr utility with the ST_REVERSE function in a SQL statement and OGR SQLite dialect: For example: ogr2ogr -dialect SQLITE -sql "select st_reverse(GEOMETRY), * from input" output.shp input.shp Note: You need to pass in the st_reverse(GEOMETRY) first as the GEOMETRY field is automatically selected if the * wildcard is used and ogr will write only ...


2

I would do it something like: def get_area(feature): return feature.GetGeometryRef().GetArea() features = [] for feature in dst_layer: features.append(feature) output = sorted(features, key=get_area, reverse=True)[:10]


1

There is no such create option in GDAL tools but a proper solution would require writing a few lines of Python code. Best workaround that comes into my mind is to select data from any existing data source with point geometries by using SQL that finds nothing. ogr2ogr -of "ESRI Shapefile" -sql "select geometry from test where 1=2" emptytest.shp test.shp ...


Only top voted, non community-wiki answers of a minimum length are eligible