<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Peter,<br>
</p>
<blockquote type="cite"
cite="mid:CACkcqcVQG5=ehbwHEXEYs0nCegd3HGf1nTDqDZHatEYbS_b0OA@mail.gmail.com">
<div dir="ltr">
<div>I have two GDAL questions that are Mapserver adjacent (or
perhaps vice-versa?). </div>
<div><br>
</div>
<div>1. Does OGRVRTDataSource allow Python code similar to
raster VRT Python Pixel Functions?</div>
</div>
</blockquote>
No. There is the possibility of writing a OGR driver in Python
(<a class="moz-txt-link-freetext" href="https://gdal.org/en/stable/development/rfc/rfc76_ogrpythondrivers.html">https://gdal.org/en/stable/development/rfc/rfc76_ogrpythondrivers.html</a>),
but this is rather experimental, and will not have great
performance.<br>
<blockquote type="cite"
cite="mid:CACkcqcVQG5=ehbwHEXEYs0nCegd3HGf1nTDqDZHatEYbS_b0OA@mail.gmail.com">
<div dir="ltr">
<div>2. Is there a reasonable way to pass custom arguments to a
VRT?</div>
<div><br>
</div>
<div>Is there a reasonable way to pass some argument to filter
the VRT? For example, a condition like `WHERE <a
href="http://some_table.id" moz-do-not-send="true">some_table.id</a>
= 123`. Imagine the query has a very large number of records.
I dont want to process the filter "client side": Ideally the
condition gets executed in SQL before OGR gets any results. I
am aware of ogr2ogr's -sql statement <a
href="https://gdal.org/en/stable/programs/ogr2ogr.html#cmdoption-ogr2ogr-sql"
moz-do-not-send="true" class="moz-txt-link-freetext">https://gdal.org/en/stable/programs/ogr2ogr.html#cmdoption-ogr2ogr-sql</a></div>
</div>
</blockquote>
<p>That would require some tweaks in the OGR PostgreSQL driver so
that a SQL result layer can forward an attribute filter to the
server (not a huge deal), and also in the MapServer OGR connector,
so that it detect that the OGR dataset is a VRT of a PostgreSQL
layer and forwards its the filter.</p>
<p>Another possibility (admitedly with some initial setup cost, but
potentially opening more future possibilities) is that you don't
directly use the MapServer CGI, but have a Python WSGI server that
intercepts requests and generate mapfiles on the fly, and use
Python MapScript to get the result.</p>
Even<span style="white-space: pre-wrap">
</span>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>