[mapserver-users] Help with runtime variable substitution in inline ODBC virtual data sources

Brent Fraser bfraser at geoanalytic.com
Tue Feb 15 18:55:33 EST 2011


Brent,

   I did something similar a while ago.  I connected to an aspatial SQL 
Server instance using an OGR VRT definition pointing to an ODBC datasource:


     TYPE POINT
     CONNECTIONTYPE OGR
     CONNECTION "<OGRVRTDataSource>
<OGRVRTLayer name='mypoints'>
<SrcDataSource>ODBC:myuser/mypass at MyODBC,view_of_points</SrcDataSource>
<SrcSQL>
             SELECT * FROM  view_of_points
             WHERE  StatusID=%StatusID%
</SrcSQL>
<FID>PointID</FID>
<GeometryType>wkbPoint</GeometryType>
<GeometryField encoding='PointFromColumns' y='MyLatitude'  x='MyLongitude'/>
<LayerSRS>NAD83</LayerSRS>
</OGRVRTLayer>
</OGRVRTDataSource>"

     PROCESSING "CLOSE_CONNECTION=DEFER"

     DATA "view_of_points"

     PROJECTION
     'proj=longlat'
     'ellps=GRS80'
     'datum=NAD83'
     'no_defs'
     END

Note that StatusId was passed as a CGI variable.

Best Regards,
Brent Fraser


On 2/15/2011 4:36 PM, pcreso at pcreso.com wrote:
> Hi,
>
> I'm looking to set up a mapfile with an inline ovf data source as 
> described in part 2 of section 5 at 
> http://mapserver.org/input/vector/VirtualSpatialData.html
>
> I'm also looking to embed an SQL in the ovf with a where clause, using 
> runtime variable substitution as described at 
> http://mapserver.org/cgi/runsub.html?highlight=variable
>
> The latter says that such runtime substitution is supported in the 
> CONNECTION & DATA fields within the LAYER object.
>
> I'm unclear as to how a where clause can be inserted in the ovf 
> definition, and am hoping that this will be in the CONNECTION or DATA 
> fields, and is amenable to runtime variable substitution.
>
> Basically with the URL including: &job_id=23
> have an ovf where clause specified like:      ...                    
> where job=%job_id%
>
>  thus from this
>
> have an ovf ODBC connection pass a where clause like:   and job_id=23 
> ..."
>
> This is connecting to an aspatial Oracle database returning up to 100 
> point features from a table with X Y columns..
>
> Can anyone provide some hints on:
>
> 1. Is this possible?
> 2. How best to implement it?
>
>
> Thanks,
>
>    Brent Wood
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110215/c53b7e6c/attachment.html


More information about the mapserver-users mailing list