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

Peter Schmitt pschmitt at gmail.com
Thu Dec 8 07:44:28 PST 2022


On Thu, Dec 8, 2022 at 12:55 AM Rahkonen Jukka <
jukka.rahkonen at maanmittauslaitos.fi> wrote:

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

This test is the closest I could find of ”layer-as-a-tileindex of vectors"
that makes me think it should work:
https://github.com/MapServer/MapServer/blob/1a45e6074b71738e576563ac39f60fd96ded50eb/msautotest/wxs/contour_tileindex.map#L70-L101

What version of MapServer are you using?

Can you try this mapfile on your version of Mapserver?

### tindex.geojson
{
"type":"FeatureCollection","features":[{"type":"Feature","properties":{"location":"/app/mapfiles/test.geojson"},"geometry":{"type":"Polygon","coordinates":[[[122.013774753,29.96355712],[122.014247522,29.915620561],[122.06927508,29.916020438],[122.068828693,29.963957768],[122.013774753,29.96355712]]]}}]}

### test.geojson
{"type":"Feature","properties":{},"geometry":{"coordinates":[[[122.04067791363536,29.944772490597998],[122.03620089848994,29.94141730774004],[122.03819740524398,29.937852301951125],[122.0446709271447,29.938166866424368],[122.04648593328471,29.940211511256464],[122.04067791363536,29.944772490597998]]],"type":"Polygon"}}

### test2.map

MAP
  OUTPUTFORMAT
    NAME "geojson"
    DRIVER "OGR/GEOJSON"
    MIMETYPE "application/json; subtype=geojson"
    FORMATOPTION "STORAGE=memory"
    FORMATOPTION "FORM=SIMPLE"
    FORMATOPTION "LCO:RFC7946=NO"
    FORMATOPTION "FILENAME=result.json"
  END

  WEB
    METADATA
      "ows_enable_request"              "*"
      "wfs_getfeature_formatlist"       "ogrgml,geojson"
    END
  END
  CONFIG "MS_ERRORFILE" "stderr"

  PROJECTION
    "init=epsg:4326"
  END


  # mapserv -nh
QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_directly&OUTPUTFORMAT=geojson'
  # returns the contents of 'test.geojson'!
  LAYER
    NAME "vector_directly"
    TYPE POLYGON
    TILEINDEX "/app/mapfiles/tindex.geojson"
    CONNECTIONTYPE OGR
    STATUS OFF
  END

  # mapserv -nh
QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=tindex_ogr&OUTPUTFORMAT=geojson'
  # returns contents of tindex.geojson!
  LAYER
    DEBUG 5
    NAME "tindex_ogr"
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "/app/mapfiles/tindex.geojson"
    STATUS OFF
  END

  # mapserv -nh
QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_tindex&OUTPUTFORMAT=geojson'
  # returns 'msTiledSHPOpenFile(): Shapefile error. Tileindex layer must be
a shapefile.'
  LAYER
    NAME "vector_via_tindex"
    TYPE POLYGON
    TILEINDEX tindex_ogr
    STATUS OFF
  END

  #  mapserv -nh
QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_via_ogr&OUTPUTFORMAT=geojson'
  # returns 'msOGRFileOpen(): OGR error. Open failed for OGR connection in
layer `vector_via_ogr'.  File not found or unsupported format. Check
server logs.'
    LAYER
        DEBUG 5
        NAME "vector_via_ogr"
        TYPE POLYGON
        TILEINDEX tindex_ogr
        CONNECTIONTYPE OGR
        STATUS OFF
    END

END # mapfile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20221208/f81f65cc/attachment-0001.htm>


More information about the MapServer-users mailing list