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 <[email protected]>
Lähetetty: torstai 8. joulukuuta 2022 2.32
Vastaanottaja: Even Rouault <[email protected]>
Kopio: Rahkonen Jukka <[email protected]>; Mapserver-Users
([email protected]) <[email protected]>
Aihe: Re: [MapServer-users] [EXTERNAL] Vector tileindex with connectiontype OGR
On Wed, Dec 7, 2022 at 4:17 PM Even Rouault
<[email protected]<mailto:[email protected]>> 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
_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users