<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I remember that I did tileindexes for vector layers a couple  of years ago.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I can’t find my example right now, but I think I was following this example for raster.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><a href="https://github.com/mapserver/mapserver/wiki/MapServer-TILEINDEXes-with-Database-RASTERS">https://github.com/mapserver/mapserver/wiki/MapServer-TILEINDEXes-with-Database-RASTERS</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><a href="https://lists.osgeo.org/pipermail/mapserver-users/2014-August/076877.html">https://lists.osgeo.org/pipermail/mapserver-users/2014-August/076877.html</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Have fun / Lars Schyberg<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> MapServer-users <mapserver-users-bounces@lists.osgeo.org>
<b>On Behalf Of </b>Peter Schmitt<br>
<b>Sent:</b> den 7 december 2022 00:56<br>
<b>To:</b> Mapserver-Users (mapserver-users@lists.osgeo.org) <mapserver-users@lists.osgeo.org><br>
<b>Subject:</b> [EXTERNAL] [MapServer-users] Vector tileindex with connectiontype OGR<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">How do I get a vector tileindex working with another Mapserver layer as the tileindex?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have the following tindex.geojson:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal">{ "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]]]}}]}<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Which points to a single file /app/mapfiles/test.geojson:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal">{"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"}}<o:p></o:p></p>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I would like to define the TILEINDEX as one MapServer Layer and have another MapServer layer reference that tile index.  I tried this layer:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">  LAYER<br>
    NAME "vector_via_ogr"<br>
    TYPE POLYGON<br>
    TILEINDEX tindex_ogr<br>
    CONNECTIONTYPE OGR<br>
    STATUS OFF<br>
  END<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<p class="MsoNormal">"msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `vector_via_ogr&#39;.  File not found or unsupported format. Check server logs."<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If I run without CONNECTIONTYPE OGR, I get the following error:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-left:30.0pt;margin-right:0cm">
<div>
<p class="MsoNormal">"msTiledSHPOpenFile(): Shapefile error. Tileindex layer must be a shapefile."<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">How do I get a vector tileindex working with another Mapserver layer as the tileindex?<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Thanks!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Pete<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Full mapfile below with example commands reproducing my errors.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">MAP<br>
  OUTPUTFORMAT<br>
    NAME "geojson"<br>
    DRIVER "OGR/GEOJSON"<br>
    MIMETYPE "application/json; subtype=geojson"<br>
    FORMATOPTION "STORAGE=memory"<br>
    FORMATOPTION "FORM=SIMPLE"<br>
    FORMATOPTION "LCO:RFC7946=NO"<br>
    FORMATOPTION "FILENAME=result.json"<br>
  END<br>
<br>
  WEB<br>
    METADATA<br>
      "ows_enable_request"              "*"<br>
      "wfs_getfeature_formatlist"       "ogrgml,geojson"<br>
    END<br>
  END<br>
  CONFIG "MS_ERRORFILE" "stderr"<br>
<br>
  PROJECTION<br>
    "init=epsg:4326"<br>
  END<br>
<br>
DEBUG 5<br>
<br>
  # mapserv -nh QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_directly&OUTPUTFORMAT=geojson'<br>
  # returns the contents of 'test.geojson'!<br>
  LAYER <br>
    NAME "vector_directly"<br>
    TYPE POLYGON<br>
    TILEINDEX "/app/mapfiles/tindex.geojson"<br>
    CONNECTIONTYPE OGR<br>
    STATUS OFF<br>
  END<br>
<br>
  # mapserv -nh QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=tindex_ogr&OUTPUTFORMAT=geojson'<br>
  # returns contents of tindex.geojson!<br>
  LAYER<br>
    NAME "tindex_ogr"<br>
    TYPE POLYGON<br>
    CONNECTIONTYPE OGR<br>
    CONNECTION "/app/mapfiles/tindex.geojson"<br>
    STATUS OFF<br>
  END<br>
<br>
  # mapserv -nh QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_tindex&OUTPUTFORMAT=geojson'<br>
  # returns 'msTiledSHPOpenFile(): Shapefile error. Tileindex layer must be a shapefile.'<br>
  LAYER<br>
    NAME "vector_via_tindex"<br>
    TYPE POLYGON<br>
    TILEINDEX tindex_ogr<br>
    STATUS OFF<br>
  END<br>
<br>
  #  mapserv -nh QUERY_STRING='service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test2.map&typename=vector_via_ogr&OUTPUTFORMAT=geojson'<br>
  # returns 'msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `vector_via_ogr&#39;.  File not found or unsupported format. Check server logs.'<br>
  LAYER<br>
    NAME "vector_via_ogr"<br>
    TYPE POLYGON<br>
    TILEINDEX tindex_ogr<br>
    CONNECTIONTYPE OGR<br>
    STATUS OFF<br>
  END<br>
<br>
END # mapfile<o:p></o:p></p>
</div>
</div>
</body>
</html>