[mapserver-users] Spatial Query problem with ODBC layer

Emerson, Gabe gemerson at WelshCo.com
Thu Oct 16 11:45:14 EDT 2008


I recently switched one of my layers from a static shapefile to an ODBC
SQL connection. The data points are correctly displayed on the map, but
when I use the "query" or "nquery" modes, I get results that don't
correspond at all to the clicked point. I tend to get the same set of
points, in various orders, none of which are anywhere near eachother and
all outside the tolerance of the query. 

I'm assuming the problem is projection related, but I'm stumped as to
how to fix it. Do I need a <LayerSRS> entry in my OVF file? I left it
out since it was causing problems, and I read that it was unnecessary if
a projection is defined in the layer. If <LayerSRS> is needed, how
should I use it? I tried setting it to WGS84 and NAD83, both caused my
points to float in the Caribbean. I've seen EPSG codes used in example
OVF files, but I got an error when I tried that.

Here's my ODBC layer:

LAYER
	NAME "brokerage"
	STATUS off
	TYPE POINT
	DATA "GIS"
	UNITS DD
	CONNECTION "eBrochure_XY.ovf"
	CONNECTIONTYPE OGR
	PROJECTION
   		   "init=epsg:4326"
 	END
      METADATA
            "wms_srs"   "4326"
            "wms_title"   "coal-test"
      END
	HEADER "../local/brokerage_header.html"
	FOOTER "../local/layer_footer.html"
	TOLERANCE 25
	TOLERANCEUNITS pixels
	CLASSITEM "P_PropertyType"
	LABELITEM "P_Name"

 ## -- Various class definitions left out -- ##

END


And my OVF file (minus the account info):
<OGRVRTDataSource>
    <OGRVRTLayer name="GIS">
        <SrcDataSource>ODBC:****/****@****</SrcDataSource> 
 	<SrcLayer>GIS</SrcLayer> 
	<GeometryType>wkbPoint</GeometryType> 
        
	<GeometryField encoding="PointFromColumns" x="geoLng"
y="geoLat"/> 
    </OGRVRTLayer>
</OGRVRTDataSource>





More information about the mapserver-users mailing list