Hot answers tagged


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 ...


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]


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