<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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {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:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Martin,
<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 you looked at the CGI runtime substitution docs?:
<a href="http://mapserver.org/cgi/runsub.html">http://mapserver.org/cgi/runsub.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">Make sure that you look at the validation section near the bottom.  If the substitution works with CGI WMS, you will need validation.<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">David.<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:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> mapserver-users-bounces@lists.osgeo.org [mailto:mapserver-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Martin Ouellet<br>
<b>Sent:</b> Wednesday, March 25, 2015 3:38 PM<br>
<b>To:</b> mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> [mapserver-users] passing parameter to a OGRVRTDataSource layer<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<div>
<p class="MsoNormal">I'm using the virtual plugin of OGR to consume a web service who return CSV coordinates and mapserver is able to draw the points without any problems.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The connection definition in my mapfile is something like this.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">CONNECTION "<OGRVRTDataSource><OGRVRTLayer name='select'><SrcDataSource>CSV:/vsicurl/http://<my server>/service.php</SrcDataSource><GeometryType>wkbPoint</GeometryType><SrcLayer>select</SrcLayer><LayerSRS>WGS84</LayerSRS><GeometryField
 encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'/></OGRVRTLayer></OGRVRTDataSource>"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I would like to pass arguments to that CONNETION string so I could build dynamic request.  something like this<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">CONNECTION "<OGRVRTDataSource><OGRVRTLayer name='select'><SrcDataSource>CSV:/vsicurl/http://<my server>/service.php?<b>param1=%PARAM1%&amp;param2=%PARAM2%</b></SrcDataSource><GeometryType>wkbPoint</GeometryType><SrcLayer>select</SrcLayer><LayerSRS>WGS84</LayerSRS><GeometryField
 encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'/></OGRVRTLayer></OGRVRTDataSource>"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I know the argument values (in my example PARAM1 and PARAM2) are OK because I'm seeing them in the error message thrown by mapserver (see below).  But mapserver refuse to render the points:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><?xml version='1.0' encoding="UTF-8" standalone="no" ?><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><!DOCTYPE ServiceExceptionReport SYSTEM "<a href="http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd">http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd</a>"><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><ServiceExceptionReport version="1.1.1"><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><ServiceException><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">msDrawMap(): Image handling error. Failed to draw layer named &#39;photo_ownedby_all&#39;.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">msOGRFileNextShape(): OGR error. Failed to find layer &#39;select&#39; on datasource &#39;CSV:/vsicurl/<b>http://<my server>/geophoto/select.php?PARAM1=40.886913500823205%2C-84.41259765625011&amp;PARAM2=63.97980162961738%2C-43.587402343750284</b>&#39;.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"></ServiceException><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"></ServiceExceptionReport><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Strangely, if I copy paste this url in the browser, the web service is returning valid csv data:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b><a href="http://%3cmy">http://<my</a> server>/geophoto/select.php?ll=40.886913500823205%2C-84.41259765625011&amp;ur=63.97980162961738%2C-43.587402343750284</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">returned <o:p></o:p></p>
</div>
<div>
<pre style="word-wrap:break-word;white-space:pre-wrap"><span style="color:black">PHOTO_LATITUDE,PHOTO_LONGITUDE<o:p></o:p></span></pre>
<pre><span style="color:black">48.8099315451953,-77.0906915758454<o:p></o:p></span></pre>
<pre><span style="color:black">48.8119226339273,-77.123176861499<o:p></o:p></span></pre>
<pre><span style="color:black">48.8139039864207,-77.1556648776822<o:p></o:p></span></pre>
<pre><span style="color:black">48.8158756013937,-77.1881556113468<o:p></o:p></span></pre>
<pre><span style="color:black">48.8178374775437,-77.2206490494331<o:p></o:p></span></pre>
<pre><span style="color:black">48.8171607148511,-77.2546364217682<o:p></o:p></span></pre>
<pre><span style="color:black">48.8164732928131,-77.2886228129866<o:p></o:p></span></pre>
<pre><span style="color:black">48.8157752119077,-77.3226082078249<o:p></o:p></span></pre>
<pre><span style="color:black">48.815066472652,-77.356592590973<o:p></o:p></span></pre>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">any thoughts?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">MartinO<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>