[MapServer-users] [EXTERNAL] Vector tileindex with connectiontype OGR

Peter Schmitt pschmitt at gmail.com
Wed Dec 7 16:31:47 PST 2022


On Wed, Dec 7, 2022 at 4:17 PM Even Rouault <even.rouault at spatialys.com>
wrote:

> How do I specify such a query using the OGR PG driver as a Mapserver layer
> to be used as a TILEINDEX of OGR vector files?
>
> A potential solution would be to create a OGR VRT file that contains your
> SQL request, and reference that VRT file in the TILEINDEX
>
>
Brilliant!  This indeed works:

    LAYER
        NAME "vector_via_vrt"
        TYPE POLYGON
        TILEINDEX "
<OGRVRTDataSource>
    <OGRVRTLayer name='layer'>
        <SrcDataSource>PG:host='localhost' user='postgres'
dbname='mydatabase' password='mypwd'</SrcDataSource>
        <SrcSQL>SELECT * FROM testtable</SrcSQL>
    </OGRVRTLayer>
</OGRVRTDataSource>"
        CONNECTIONTYPE OGR
        STATUS OFF
    END

and now requests like
http://localhost:8000/wfs?service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test.map&typename=vector_via_vrt&OUTPUTFORMAT=geojson
return the vectors pointed by the vector tileindex of vectors.  I will
attempt to submit a PR to add this example to the docs when I can.

VRTs:  Is there anything they can't do!?

Cheers,
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20221207/cfdad25f/attachment.htm>


More information about the MapServer-users mailing list