[MapServer-users] [EXTERNAL] Vector tileindex with connectiontype OGR
Rahkonen Jukka
jukka.rahkonen at maanmittauslaitos.fi
Wed Dec 7 23:55:53 PST 2022
Hi,
We are using the ”layer-as-a-tileindex” method right now with a bit older Mapserver version and with native POSTGIS connection type. In the orthophoto layer we use
LAYER
GROUP "ortokuva"
NAME "ortokuva_r16"
STATUS ON
TILEINDEX "ortokuva_r16_postgis_tileindex"
TILESRS "crs"
and in the "ortokuva_r16_postgis_tileindex" layer
LAYER
NAME "ortokuva_r16_postgis_tileindex"
STATUS ON
TYPE POLYGON
UNITS METERS
SIZEUNITS PIXELS
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=db user=user password=password"
DATA "the_geom from (SELECT fid, '/beginning/of/path/'||location as location, crs, resolution, the_geom FROM ortokuva_16m) as subquery using unique fid"
I hope that this still works with Mapserver 8. It would be nice if you could make a test and compare OGR vs POSTGIS connection types.
-Jukka Rahkonen-
Lähettäjä: Peter Schmitt <pschmitt at gmail.com>
Lähetetty: torstai 8. joulukuuta 2022 2.32
Vastaanottaja: Even Rouault <even.rouault at spatialys.com>
Kopio: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>; Mapserver-Users (mapserver-users at lists.osgeo.org) <mapserver-users at lists.osgeo.org>
Aihe: Re: [MapServer-users] [EXTERNAL] Vector tileindex with connectiontype OGR
On Wed, Dec 7, 2022 at 4:17 PM Even Rouault <even.rouault at spatialys.com<mailto: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/20221208/916b418e/attachment.htm>
More information about the MapServer-users
mailing list