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

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Wed Dec 7 11:18:41 PST 2022


Hi,

I made some tests and noticed that the OGR tileindex does not need to be a shapefile but GeoPackage worked as well. Actully what did not work was to make a vector layer from tileindex that was saved into GeoPackage and to use that layer in TILEINDEX. And then I noticed that this behavior is documented in https://www.mapserver.org/input/vector/ogr.html#tileindex-with-ogr:

"OGR layers can utilize tile indexes in a similar fashion to Shapefile based layers. The TILEINDEX keyword should contain the connection string for the tile index file. The tile index file may be any supported OGR format, including shapefiles."

So this is what I used in LAYER and it worked both for WMS and WFS:

CONNECTIONTYPE OGR
TILEINDEX "c:\data\000\mapservertest\tindex.gpkg"

I do not know when and if this behavior has changed. I thought as well that the layer-as-a-tileindex would be the way to follow if tileindex is not in shapefile format.

-Jukka Rahkonen-

Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> Puolesta Peter Schmitt
Lähetetty: keskiviikko 7. joulukuuta 2022 19.08
Vastaanottaja: Schylberg Lars <lars.schylberg at saabgroup.com>
Kopio: 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 1:16 AM Schylberg Lars <lars.schylberg at saabgroup.com<mailto:lars.schylberg at saabgroup.com>> wrote:
> The important thing is to have a one layer for the actual tile index, that has status off and one layer that is using the tile index layer.

Thanks for the message, Lars!  This gave me another idea to debug.

When I set DEBUG 5 and request

     mapserv -nh QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_via_ogr&OUTPUTFORMAT=geojson'

then the log contains

    OGROPen(tindex_ogr)
    msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `vector_via_ogr'.  File not found or unsupported format. Check server logs.
    Open failed for OGR connection in layer `vector_via_ogr'.

with the layers
    LAYER
        DEBUG 5
        NAME "tindex_ogr"
        TYPE POLYGON
        CONNECTIONTYPE OGR
        CONNECTION "/app/mapfiles/tindex.geojson"
        STATUS OFF
    END

    LAYER
        DEBUG 5
        NAME "vector_via_ogr"
        TYPE POLYGON
        TILEINDEX tindex_ogr
        CONNECTIONTYPE OGR
        STATUS OFF
    END

This log line

        OGROPen(tindex_ogr)

makes me suspect the following lines of code are setting the OGR dataset name to "tindex_ogr", whereas I expect it to do something like use the value from CONNECTION in the layer with name "tindex_ogr".
https://github.com/MapServer/MapServer/blob/71ecf4028b0769027df3a970a36d56feb1d46ab6/mapogr.cpp#L1205-L1238<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMapServer%2FMapServer%2Fblob%2F71ecf4028b0769027df3a970a36d56feb1d46ab6%2Fmapogr.cpp%23L1205-L1238&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C6cce5ce3dc674b610d1608dad875a01d%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C638060296970211320%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3bCVBIt9JxfoIArjTPKTM4AREHBzvW5iq%2Fev8XsfZJw%3D&reserved=0>

In other words, I expect the log line to read

        OGROPen(/app/mapfiles/tindex.geojson)

and not

        OGROPen(tindex_ogr)

This seems to be unique for a vector tile index of vectors.  This otherwise works fine when using a vector tileindex of rasters.  So if I make a bogus raster layer like

    LAYER
        DEBUG 5
        NAME "bogus_raster"
        TYPE RASTER
        TILEINDEX tindex_ogr
        STATUS OFF
        PROJECTION
            "init=epsg:3857"
        END
    END

and then issue a bogus request like

    curl 'http://localhost:8000/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&map=/app/mapfiles/test2.map&layers=bogus_raster&WIDTH=256&HEIGHT=256&CRS=EPSG:3857&STYLES=&BBOX=4163066.308523841,5943743.319455305,4167958.2783340923,5948635.289265556'

Then the log line includes

     msOGRFileOpen(/app/mapfiles/tindex.geojson)...
     OGROPen(/app/mapfiles/tindex.geojson)
     msConnPoolRegister(tindex_ogr,/app/mapfiles/tindex.geojson,0x556aba222630)

and _not_

     msOGRFileOpen(tindex_ogr)...

like I see for a vector tile index of vectors.

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


More information about the MapServer-users mailing list