[gdal-dev] New capabilities in OGR VRT : OGRVRTWarpedLayer and OGRVRTUnionLayer

Even Rouault even.rouault at mines-paris.org
Sun Jul 1 13:51:34 PDT 2012


Hi,

FYI, I've just commited into trunk a few extensions to the OGR VRT syntax.

In addition to the existing <OGRVRTLayer>, <OGRVRTDataSource> can now accept :
- a <OGRVRTWarpedLayer> child to do on-the-fly reprojection of a base layer
- a <OGRVRTUnionLayer> to do on-the-fly concatenation of several base layers.

Examples from the updated http://gdal.org/ogr/drv_vrt.html :

"""
Example: Reprojected layer (GDAL >= 2.0.0)
The following example will return the source.shp layer reprojected to 
EPSG:4326.

<OGRVRTDataSource>
    <OGRVRTWarpedLayer>
        <OGRVRTLayer name="source">
            <SrcDataSource>source.shp</SrcDataSource>
        </OGRVRTLayer>
        <TargetSRS>EPSG:4326</TargetSRS>
    </OGRVRTWarpedLayer>
</OGRVRTDataSource>

Example: Union layer (GDAL >= 2.0.0)
The following example will return a layer that is the concatenation of 
source1.shp and source2.shp.

<OGRVRTDataSource>
    <OGRVRTUnionLayer name="unionLayer">
        <OGRVRTLayer name="source1">
            <SrcDataSource>source1.shp</SrcDataSource>
        </OGRVRTLayer>
        <OGRVRTLayer name="source2">
            <SrcDataSource>source2.shp</SrcDataSource>
        </OGRVRTLayer>
    </OGRVRTUnionLayer>
</OGRVRTDataSource>
"""


The unioning capability can also be used in OGR SQL, for example :
"SELECT * FROM first_layer UNION ALL SELECT * FROM second_layer"

Best regards,

Even


More information about the gdal-dev mailing list