<div dir="ltr"><div dir="ltr">On Wed, Dec 7, 2022 at 4:17 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><div>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? <br>
          </div>
        </div>
      </div>
    </blockquote>
    A potential solution would be to create a OGR VRT file that contains
    your SQL request, and reference that VRT file in the TILEINDEX<br><br></div></blockquote><div><br></div><div>Brilliant!  This indeed works:</div><div><br></div>    LAYER<br>        NAME "vector_via_vrt"<br>        TYPE POLYGON<br>        TILEINDEX "<br><OGRVRTDataSource><br>    <OGRVRTLayer name='layer'><br>        <SrcDataSource>PG:host='localhost' user='postgres' dbname='mydatabase' password='mypwd'</SrcDataSource><br>        <SrcSQL>SELECT * FROM testtable</SrcSQL><br>    </OGRVRTLayer><br></OGRVRTDataSource>"<br>        CONNECTIONTYPE OGR<br>        STATUS OFF<br><div>    END </div><div><br></div><div>and now requests like <a href="http://localhost:8000/wfs?service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test.map&typename=vector_via_vrt&OUTPUTFORMAT=geojson">http://localhost:8000/wfs?service=WFS&VERSION=1.0.0&REQUEST=getfeature&map=/app/mapfiles/test.map&typename=vector_via_vrt&OUTPUTFORMAT=geojson</a> 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.</div><div><br></div><div>VRTs:  Is there anything they can't do!?</div><div><br></div><div>Cheers,</div><div>Pete</div></div></div>