[gdal-dev] ogr_dispatch.py: dispatch features into layers according to the value of some fields or the geometry type

Even Rouault even.rouault at mines-paris.org
Sun Jun 2 04:07:19 PDT 2013


Hi,

http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogr_dispatch.py is a 
new utility that can be used typically to dispatch features of datasource that 
mix in a single layer features of several geometry types into separate target 
layers, to match a typical constraint enforced in most GIS formats (one 
geometry type per layer). You can also use it to dispatch features according 
to the value of a field.

From the usage message:

"""

ogr_dispatch.py [-f format] -src name -dst name [-field field]+
                [-25D_as_2D] [-multi_as_single]
                [-remove_dispatch_fields] [-prefix_with_out_lyr_name]
                [-dsco KEY=VALUE]* [-lco KEY=VALUE]* [-a_srs srs_def]
                [-style_as_field] [-where restricted_where] [-gt n] [-quiet]

Dispatch features into layers according to the value of some fields or their
geometry type.

Arguments:
 -f format: name of the driver to use to create the destination dataset
            (default 'ESRI Shapefile').
 -src name: name of the source dataset.
 -dst name: name of the destination dataset (existing or to be created).
 -field field: name of a field to use to dispatch features. May also
                        be 'OGR_GEOMETRY'. At least, one occurence needed.
 -25D_as_2D: for dispatching, consider 2.5D geometries as 2D.
 -multi_as_single: for dispatching, consider MULTIPOLYGON as POLYGON and
                   MULTILINESTRING as LINESTRING.
 -remove_dispatch_fields: remove the dispatch fields from the target layer 
definitions.
 -prefix_with_out_lyr_name: prefix the target layer name with the source layer 
name.
 -dsco KEY=VALUE: dataset creation option. May be repeated.
 -lco KEY=VALUE: layer creation option. May be repeated.
 -a_srs srs_def: assign a SRS to the target layers. Source layer SRS is 
otherwise used.
 -style_as_field: add a OGR_STYLE field with the content of the feature style 
string.
 -where restricted_where: where clause to filter source features.
 -gt n: group n features per transaction (default 200).

Example :
  ogr_dispatch.py -src in.dxf -dst out -field Layer -field OGR_GEOMETRY

"""

Best regards,

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list