[Qgis-developer] Vector equivalent of a VRT
Zoltan Szecsei
zoltans at geograph.co.za
Sun Oct 26 07:01:10 PDT 2014
On 2014/10/26 15:57, Even Rouault wrote:
> Le dimanche 26 octobre 2014 14:37:04, Zoltan Szecsei a écrit :
>> On 2014/10/24 18:49, Andre Joost wrote:
>>> +100 from me if you promise to build a QGIS plugin for the purpose ;-)
>> Well, I'm not building a plugin - but rather a bash script, both to keep
>> it simple, and to further my knowledge.
>>
>> So,
>> My script is working insofar as I am getting a VRT that QGIS (v2.5.0 rev
>> b43d131 and gdal/ogr 1.11.0) loads, _but it comes in with zero elements._
>> For guidance I am using http://www.gdal.org/drv_vrt.html
>>
>> I have tried wrapping each SHP file in it's own <OGRVRTLayer
>> name:shpname>, and below is the version having a global OGRVRTLayer name.
>>
>>> <OGRVRTDataSource>
>>>
>>> <OGRVRTLayer name="River">
>>>
>>> <SrcDataSource>ESRI
>>>
>>> Shapefile:2730/2730_RIVER_LINE_2006_06.shp</SrcDataSource>
>>>
>>> <relativeToVRT>1</relativeToVRT>
>>>
>>> <SrcLayer>2730_RIVER_LINE_2006_06</SrcLayer>
>>>
>>> <ExtentXMin>30.000000</ExtentXMin>
>>> <ExtentYMin>-28.000037</ExtentYMin>
>>> <ExtentXMax>31.000000</ExtentXMax>
>>> <ExtentYMax>-27.000000</ExtentYMax>
>>> <SrcDataSource>ESRI
>>>
>>> Shapefile:2731/2731_RIVER_LINE_2006_04.shp</SrcDataSource>
>>>
>>> <relativeToVRT>1</relativeToVRT>
>>>
>>> <SrcLayer>2731_RIVER_LINE_2006_04</SrcLayer>
>>>
>>> <ExtentXMin>31.000000</ExtentXMin>
>>> <ExtentYMin>-28.000000</ExtentYMin>
>>> <ExtentXMax>32.250000</ExtentXMax>
>>> <ExtentYMax>-27.000000</ExtentYMax>
>>> <SrcDataSource>ESRI
>>>
>>> Shapefile:2732/2732_RIVER_LINE_2006_04.shp</SrcDataSource>
>>>
>>> <relativeToVRT>1</relativeToVRT>
>>>
>>> <SrcLayer>2732_RIVER_LINE_2006_04</SrcLayer>
>>>
>>> <ExtentXMin>32.000000</ExtentXMin>
>>> <ExtentYMin>-28.000000</ExtentYMin>
>>> <ExtentXMax>32.819133</ExtentXMax>
>>> <ExtentYMax>-27.000000</ExtentYMax>
>>>
>>> </OGRVRTLayer>
>>>
>>> </OGRVRTDataSource>
>> Can someone please give me some pointers as to what is incorrect or
>> missing in my VRT file?
> You need to encapsulate the 3 layers in a OGRVRTUnionLayer. A single
> OVRTVRTLayer can only have a single SrcDataSource. And you need to put
> directly the file name, without the "ESRI Shapefile:" prefix.
>
> From the doc :
> """Example: Union layer (GDAL >= 1.10.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>
> """
>
> You don't need to specify the Extent generally.
Thanks Even.
Typical me: I try to interpret the instructions, and not follow the
examples..........
Regards,
Zoltan
--
===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
GIS and Photogrammetric Services
P.O. Box 7, Muizenberg 7950, South Africa.
Mobile: +27-83-6004028
Fax: +27-86-6115323 www.geograph.co.za
===========================================
More information about the Qgis-developer
mailing list