[mapserver-users] How to access Templating: Map Geometry Variables(or Equivalent) from OGR Connection

Steve Lime Steve.Lime at dnr.state.mn.us
Fri Apr 3 10:38:44 EDT 2009


This would be a feature request. The runtime subs are done well ahead of the computation
of things like map extent. This would be a relatively simple hack and I can show you where
in the CGI code to try it out if you'd like.

Steve

>>> joncoign <jncoign at Knology.net> 04/02/09 10:47 AM >>>

I didn't get a response to my previous post so I wanted to rewrite it and attempt to make it more general. We make OGR ODBC requests to SQL Server 2005 with MSSQLSpatial extensions. To get good performance out of this system and to further secure the paramters we have been using stored procedures so we can optimize the queries inside of the database. This results in a connection object that similar to the following:

    CONNECTIONTYPE OGR
    CONNECTION "<OGRVRTDataSource>
                    <OGRVRTLayer name='GDT'>
                         <SrcDataSource>ODBC:MSSQLSPATIALDSN,states</SrcDataSource>
                        <SrcSQL>    
                            EXEC dbo.MappingGetStates %BBOX%
                        </SrcSQL>
                        <GeometryField encoding='WKB' field='the_geom' />
                    </OGRVRTLayer>
                </OGRVRTDataSource>"
     DATA "GDT"

We have had good luck using Variable Subsitution from the querystring however, sometimes it would be useful to be able to access additional varaibles from within mapserver such as those defined in the Templating section of the documentation (an alternative method to access equivalent data would be full acceptable). Specifically, it would be nice to have access to [mapext], [minx], [miny], [maxx], [maxy], [rawext], [mapext_latlon], [minlon], [minlat], [maxlon] [maxlat]. To be explicit I am asking is there a way to use these inside of the <SrcSQL> section of the CONNECTION.

Is this functionality currently available and something I have overlooked in the manual or would this fall under the category of a feature request?

Looking forward to SQL Server 2008 I think this approach will still have merit as it offers quite a bit of additional flexibility in writing and optimizing the query over what I have been able to achieve thus far with the Native SQL Server 2008 driver. I should stipulate I have only been using the new driver for a couple of weeks so I may not find it as limiting after additional testing.



I have a WFS Server layer defined and have recently needed to provide this service in an alternate projection. The Data is in EPSG:4326 and I need the WFS Service to provide it in Spherical Mercator (SM / EPSG:900913). I have this working properly with the layers projection definition and wfs_srs.

The problem I have is that previously I was passing the %BBOX% parameter to the database stored procedure using an <OGRVRTDataSource>  referencing an ODBC connection. 

When reprojecting the WFS layer the %BBOX% does not get reprojected so it gets sent to the database in meters as defined in SM. I could reproject this in the Stored Procedure, but my client would prefer I treat their DB as a black box and not make changes. Am I correct in assuming that %BBOX% comes unaltered from the querystring? Is there another variable I can use with Variable substitution to get the BBOX in the data's projection? Or is there a way to reproject %BBOX% variable? 

It is critical that I can filter the data coming out of the spatial DB before it gets to MapServer for performance reasons.

Any help is greatly appreciated.
Jon




-- 
View this message in context: http://n2.nabble.com/WFS-Server-Request-w-Reprojection-to-Database-tp2545150p2575962.html
Sent from the Mapserver - User mailing list archive at Nabble.com.

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list