Vector equivalent of a VRT

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Vector equivalent of a VRT

Zoltan Szecsei
Hi All,
I've been googling around, but cannot find what I'm hoping for.

Is there a VRT implementation for vector data?

It would be nice to have a single name to load into QGIS for a set of
vector data (eg SHP files), and as you pan around your 'VVT' file, QGIS
would open and display only the files relevant to your current view-port.
This is of course very useful for NGI's sheet based vector offering -
but the VVT implementation need not bother checking for overlapping
vector data, but simply index by the MBR of each (SHP) file.

TIA,
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
===========================================

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

amondot
Hello,

Have a look on OGR VRT.
http://www.gdal.org/drv_vrt.html

Alexia

Zoltan Szecsei <[hidden email]> a écrit :

> Hi All,
> I've been googling around, but cannot find what I'm hoping for.
>
> Is there a VRT implementation for vector data?
>
> It would be nice to have a single name to load into QGIS for a set  
> of vector data (eg SHP files), and as you pan around your 'VVT'  
> file, QGIS would open and display only the files relevant to your  
> current view-port.
> This is of course very useful for NGI's sheet based vector offering  
> - but the VVT implementation need not bother checking for  
> overlapping vector data, but simply index by the MBR of each (SHP)  
> file.
>
> TIA,
> 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
> ===========================================
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Andre Joost
In reply to this post by Zoltan Szecsei
Am 24.10.2014 um 16:16 schrieb Zoltan Szecsei:
> Hi All,
> I've been googling around, but cannot find what I'm hoping for.
>
> Is there a VRT implementation for vector data?
>

Surely:

http://www.gdal.org/drv_vrt.html

unfortunately, there is no easy-to use transformation for it.

 From the page:
> The virtual files are currently normally prepared by hand.

And hence QGIS can not save into that format.


HTH,
André Joost

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Zoltan Szecsei
On 2014/10/24 16:36, Andre Joost wrote:

> Am 24.10.2014 um 16:16 schrieb Zoltan Szecsei:
>> Hi All,
>> I've been googling around, but cannot find what I'm hoping for.
>>
>> Is there a VRT implementation for vector data?
>>
>
> Surely:
>
> http://www.gdal.org/drv_vrt.html
>
> unfortunately, there is no easy-to use transformation for it.
>
> From the page:
>> The virtual files are currently normally prepared by hand.
>
> And hence QGIS can not save into that format.
>
>
> HTH,
> André Joost
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

Yep. Looking at it now - thanks Alexia as well.

-1 for me not trying harder before posting :-)
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
===========================================

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Tim Sutton-6

Hi
On Oct 24, 2014 4:43 PM, "Zoltan Szecsei" <[hidden email]> wrote:
>
> On 2014/10/24 16:36, Andre Joost wrote:
>>
>> Am 24.10.2014 um 16:16 schrieb Zoltan Szecsei:
>>>
>>> Hi All,
>>> I've been googling around, but cannot find what I'm hoping for.
>>>
>>> Is there a VRT implementation for vector data?
>>>
>>
>> Surely:
>>
>> http://www.gdal.org/drv_vrt.html
>>
>> unfortunately, there is no easy-to use transformation for it.
>>
>> From the page:
>>>
>>> The virtual files are currently normally prepared by hand.
>>
>>
>> And hence QGIS can not save into that format.
>>
>>
>> HTH,
>> André Joost
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
> Yep. Looking at it now - thanks Alexia as well.
>
> -1 for me not trying harder before posting :-)

Make that -2 for forgetting that someone mentioned the fact that you can have vector vrt's to you before on the QGIS mailing list  :-)

http://osgeo-org.1560.x6.nabble.com/To-Save-Ogr-Layer-in-VRT-td5160007.html

Regards

Tim

> 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
> ===========================================
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Andre Joost
Am 24.10.2014 um 17:08 schrieb Tim Sutton:

> Hi
> On Oct 24, 2014 4:43 PM, "Zoltan Szecsei" <[hidden email]> wrote:
>>
>> On 2014/10/24 16:36, Andre Joost wrote:
>>>
>>> Am 24.10.2014 um 16:16 schrieb Zoltan Szecsei:
>>>>
>>>> Hi All,
>>>> I've been googling around, but cannot find what I'm hoping for.
>>>>
>>>> Is there a VRT implementation for vector data?
>>>>
>>>
>>> Surely:
>>>
>>> http://www.gdal.org/drv_vrt.html
>>>
>>> unfortunately, there is no easy-to use transformation for it.
>>>
>>>  From the page:
>>>>
>>>> The virtual files are currently normally prepared by hand.
>>>
>>>
>>> And hence QGIS can not save into that format.
>>>
>>>
>>> HTH,
>>> André Joost
>>>
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> [hidden email]
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>> Yep. Looking at it now - thanks Alexia as well.
>>
>> -1 for me not trying harder before posting :-)
>
> Make that -2 for forgetting that someone mentioned the fact that you can
> have vector vrt's to you before on the QGIS mailing list  :-)
>

+100 from me if you promise to build a QGIS plugin for the purpose ;-)

Greetings,
André Joost

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Tim Sutton-6

Hi
On Oct 24, 2014 6:51 PM, "Andre Joost" <[hidden email]> wrote:
>
> Am 24.10.2014 um 17:08 schrieb Tim Sutton:
>>
>> Hi
>>
>> On Oct 24, 2014 4:43 PM, "Zoltan Szecsei" <[hidden email]> wrote:
>>>
>>>
>>> On 2014/10/24 16:36, Andre Joost wrote:
>>>>
>>>>
>>>> Am 24.10.2014 um 16:16 schrieb Zoltan Szecsei:
>>>>>
>>>>>
>>>>> Hi All,
>>>>> I've been googling around, but cannot find what I'm hoping for.
>>>>>
>>>>> Is there a VRT implementation for vector data?
>>>>>
>>>>
>>>> Surely:
>>>>
>>>> http://www.gdal.org/drv_vrt.html
>>>>
>>>> unfortunately, there is no easy-to use transformation for it.
>>>>
>>>>  From the page:
>>>>>
>>>>>
>>>>> The virtual files are currently normally prepared by hand.
>>>>
>>>>
>>>>
>>>> And hence QGIS can not save into that format.
>>>>
>>>>
>>>> HTH,
>>>> André Joost
>>>>
>>>> _______________________________________________
>>>> Qgis-developer mailing list
>>>> [hidden email]
>>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>>
>>>
>>> Yep. Looking at it now - thanks Alexia as well.
>>>
>>> -1 for me not trying harder before posting :-)
>>
>>
>> Make that -2 for forgetting that someone mentioned the fact that you can
>> have vector vrt's to you before on the QGIS mailing list  :-)
>>
>
> +100 from me if you promise to build a QGIS plugin for the purpose ;-)
>
> Greetings,
>
> André Joost

We could build something - at least for the use case where you want to create a mosaic of shp files that have the same attributes... But i have to wonder if there is much point - just importing them into spatialite or postgis seems like a much nicer approach. You could always dump out spatially separated shapefiles again from postgis.

Regards

Tim

>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Andre Joost
Am 26.10.2014 um 11:35 schrieb Tim Sutton:

>
> We could build something - at least for the use case where you want to
> create a mosaic of shp files that have the same attributes... But i have to
> wonder if there is much point - just importing them into spatialite or
> postgis seems like a much nicer approach. You could always dump out
> spatially separated shapefiles again from postgis.

I thought of a vector vrt driver as first part of creating GeoPDF from
vector and raster layers, as described in
http://latuviitta.org/documents/Geospatial_PDF_maps_from_OSM_with_GDAL.pdf 
which is still much handwork.

Up to now, only Raster export to GeoPDF is possible via GDAL.

Greetings,
André Joost

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Zoltan Szecsei
In reply to this post by Andre Joost
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?
TIA,
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
===========================================

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Even Rouault-2
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.


> TIA,
> Zoltan

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Zoltan Szecsei
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
===========================================

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Zoltan Szecsei
On 2014/10/26 16:01, Zoltan Szecsei wrote:

> 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.
>
I still get no syntax errors on opening the VRT, and no features either.
Could it be the 'slashes' in the filename? I would have thought they'd
be OK because they are in double-quotes:

<OGRVRTDataSource>
   <OGRVRTUnionLayer name="Rivers">
   <OGRVRTLayer name="2730_RIVER_LINE_2006_06">
<SrcDataSource>2730/2730_RIVER_LINE_2006_06.shp</SrcDataSource>
   </OGRVRTLayer>
   <OGRVRTLayer name="2731_RIVER_LINE_2006_04">
<SrcDataSource>2731/2731_RIVER_LINE_2006_04.shp</SrcDataSource>
   </OGRVRTLayer>
   <OGRVRTLayer name="2732_RIVER_LINE_2006_04">
<SrcDataSource>2732/2732_RIVER_LINE_2006_04.shp</SrcDataSource>
   </OGRVRTLayer>
   </OGRVRTUnionLayer>
</OGRVRTDataSource>


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

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Even Rouault-2

> I still get no syntax errors on opening the VRT, and no features either.
> Could it be the 'slashes' in the filename?

No that's OK

> I would have thought they'd
> be OK because they are in double-quotes:

You likely need to add the attribute  relativeToVRT="1" in <SrcDataSource> so
that the paths are interpreated relatively to the VRT file.

i.e.

 <SrcDataSource  
relativeToVRT="1">2730/2730_RIVER_LINE_2006_06.shp</SrcDataSource>

You can check with "ogrinfo -al /path/to/your.vrt" to see if it works and if
there are error messages.

>
> <OGRVRTDataSource>
>    <OGRVRTUnionLayer name="Rivers">
>    <OGRVRTLayer name="2730_RIVER_LINE_2006_06">
> <SrcDataSource>2730/2730_RIVER_LINE_2006_06.shp</SrcDataSource>
>    </OGRVRTLayer>
>    <OGRVRTLayer name="2731_RIVER_LINE_2006_04">
> <SrcDataSource>2731/2731_RIVER_LINE_2006_04.shp</SrcDataSource>
>    </OGRVRTLayer>
>    <OGRVRTLayer name="2732_RIVER_LINE_2006_04">
> <SrcDataSource>2732/2732_RIVER_LINE_2006_04.shp</SrcDataSource>
>    </OGRVRTLayer>
>    </OGRVRTUnionLayer>
> </OGRVRTDataSource>
>
>
> Regards,
> Zoltan

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT

Zoltan Szecsei
On 2014/10/26 16:22, Even Rouault wrote:
> You likely need to add the attribute  relativeToVRT="1" in <SrcDataSource> so
> that the paths are interpreated relatively to the VRT file.
>
> i.e.
>
>   <SrcDataSource
> relativeToVRT="1">2730/2730_RIVER_LINE_2006_06.shp</SrcDataSource>

Magic! - It works.
I did have the relativeToVRT in an earlier version, but my syntax was wrong.

I've got some general VRT queries, but I'll start a new thread on those.

Big thanks and enjoy the rest of the weekend.

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

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Vector equivalent of a VRT - Linux bash script

Zoltan Szecsei
In reply to this post by Andre Joost
On 2014/10/24 18:49, Andre Joost wrote:
>
> +100 from me if you promise to build a QGIS plugin for the purpose ;-)
>

Right.... with a little help on the VRT syntax, from Even, this script
will create you a vrt file (ie: in a simple case, 'ogrbuildvrt' :-)  )

#!/bin/bash
#
# Bash script to generate a VRT for SHP files
#
# Author: Zoltan Szecsei  [hidden email]
# Date:   26 October 2014
#
# Notes:
#       'find' is used instead of 'ls -1' as find descends nicely into
subdirectories
#       WLC is the wildcard for 'find' to find the shapefiles you want
#       DIR is the parent directory, above the shapefiles you want to
add into this VRT
#       NAM is the name you want to see in your QGIS 'Legend' sidebar
#       VRT is the me of the vrt file that will (must) be
#
#
WLC="*build*point*.shp"
DIR="."
NAM="MyVRT"
VRT="${DIR}/${NAM}.vrt"
echo "<OGRVRTDataSource>" > $VRT
echo "  <OGRVRTUnionLayer name=\"${NAM}\">" >> $VRT
for shp in `find $DIR -iname $WLC`
do
   lay="`ogrinfo  -al -so $shp | grep -i "layer name:" | awk '{print $3}'`"
   echo   "  <OGRVRTLayer name=\"$lay\">" >> $VRT
   echo   "    <SrcDataSource relativeToVRT=\"1\">${shp}</SrcDataSource>
" >> $VRT
   echo   "  </OGRVRTLayer>" >> $VRT
done
echo "  </OGRVRTUnionLayer>" >> $VRT
echo "</OGRVRTDataSource>"   >> $VRT


Hope it's useful to some.
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
===========================================

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer