[MapServer-users] [EXTERNAL] Vector tileindex with connectiontype OGR
Schylberg Lars
lars.schylberg at saabgroup.com
Wed Dec 7 00:16:46 PST 2022
Hi,
I remember that I did tileindexes for vector layers a couple of years ago.
I can’t find my example right now, but I think I was following this example for raster.
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. In my case I did it with sqlite if remember correctly. I believe I was following this example for raster, but did it with vector data.
https://github.com/mapserver/mapserver/wiki/MapServer-TILEINDEXes-with-Database-RASTERS
https://lists.osgeo.org/pipermail/mapserver-users/2014-August/076877.html
Have fun / Lars Schyberg
From: MapServer-users <mapserver-users-bounces at lists.osgeo.org> On Behalf Of Peter Schmitt
Sent: den 7 december 2022 00:56
To: Mapserver-Users (mapserver-users at lists.osgeo.org) <mapserver-users at lists.osgeo.org>
Subject: [EXTERNAL] [MapServer-users] Vector tileindex with connectiontype OGR
Hi,
How do I get a vector tileindex working with another Mapserver layer as the tileindex?
I have the following 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]]]}}]}
Which points to a single file /app/mapfiles/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"}}
I would like to define the TILEINDEX as one MapServer Layer and have another MapServer layer reference that tile index. I tried this layer:
LAYER
NAME "vector_via_ogr"
TYPE POLYGON
TILEINDEX tindex_ogr
CONNECTIONTYPE OGR
STATUS OFF
END
but when I run `mapserv -nh QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_via_ogr&OUTPUTFORMAT=geojson'`, I get the following error:
"msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `vector_via_ogr'. File not found or unsupported format. Check server logs."
If I run without CONNECTIONTYPE OGR, I get the following error:
"msTiledSHPOpenFile(): Shapefile error. Tileindex layer must be a shapefile."
I can get a similar thing working for a TILEINDEX of rasters. However I cannot get it working on a TILEINDEX of vectors. The example below is the simplest reproduce case I could create. Ultimately I plan on having a TILEINDEX point to a layer of defined via CONNECTIONTYPE postgis.
How do I get a vector tileindex working with another Mapserver layer as the tileindex?
Thanks!
Pete
Full mapfile below with example commands reproducing my errors.
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
DEBUG 5
# 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
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
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/20221207/82b774b4/attachment.htm>
More information about the MapServer-users
mailing list