Geoscience Reference
In-Depth Information
One of the particular advantages of the VRT driver is that it is possible to register a
variety of different data types (points, lines and polygons) and formats within a single
VRT. We will continue our example by adding the county boundaries for Ireland from
the GADMwebsite. 6 These are available for download as ESRI Shapefiles projected
in WGS84 (EPSG:4326), but we use the VRT to reproject them to the Irish National
Grid (EPSG:29900) on the fly.
...
<OGRVRTLayer name="Ireland_Admin">
<SrcDataSource>./IRL_adm0.shp</SrcDataSource>
<SrcLayer>IRL_adm0</SrcLayer>
<TargetSRS>EPSG:29900</TargetSRS>
</OGRVRTLayer>
<!-- FINAL XML TAG -->
</OGRVRTDataSource>
We can go a step further with the VRT and generate another virtual layer that
represents the convex hull of county boundary of Clare (located on the west coast of
Ireland). This can be achieved using the SQLite dialect within the SrcSQL tag. The
output of these administrative datasets are presented in Fig. 2.3 and the convex hull
g enerated for county Clare (Fig. 2.4 ).
...
<OGRVRTLayer name="Convex_Ireland_Admin">
<SrcDataSource>./IRL_adm1.shp</SrcDataSource>
<SrcLayer>IRL_adm1</SrcLayer>
<SrcSQL dialect="sqlite">SELECT ConvexHull(geometry)
from IRL_adm1 WHERE NAME_1 = 'Clare'</SrcSQL>
<TargetSRS>EPSG:29900</TargetSRS>
</OGRVRTLayer>
<!-- FINAL XML TAG -->
</OGRVRTDataSource>
If we wanted to generate the country boundary from the set of county boundaries,
we could add a new VRT layer and use the ST_Union function from SQLite. This
would essential dissolve all boundaries to generate a vector layer consisting of only
o ne feature. The definition of this layer is outlined below.
...
<OGRVRTLayer name="IRL_Counties_diss">
<SrcDataSource>./IRL_adm1.shp</SrcDataSource>
<SrcLayer>IRL_adm1</SrcLayer>
<SrcSQL dialect="sqlite">SELECT ST_Union(geometry) from
IRL_adm1</SrcSQL>
<TargetSRS>EPSG:29900</TargetSRS>
</OGRVRTLayer>
<!-- FINAL XML TAG -->
</OGRVRTDataSource>
 
 
 
Search WWH ::




Custom Search