<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Hi Frank</DIV>
<DIV> </DIV>
<DIV>Fantastic! I do have a unique integer id on the database table "apiary_id". Including the line <FID>apiary_id</FID> in my .ovf file solved the problem.</DIV>
<DIV> </DIV>
<DIV>Many thanks,</DIV>
<DIV> </DIV>
<DIV>Robert Sanson<BR><BR>>>> Frank Warmerdam <warmerdam@pobox.com> 20/05/2008 11:53 a.m. >>><BR></DIV>
<DIV style="COLOR: #000000">Robert Sanson wrote:<BR>> Dear List<BR>>  <BR>> I have set up Mapserver map file configured as a WMS service. One of my <BR>> layers is a OGR point data source drawing its coodinates from x,y fields <BR>> in a SQL-Server database via ODBC. The x,y coordinates are in NZ Map <BR>> Grid projection (EPSG:27200) but all my other layers are NZ Transverse <BR>> Mercator (EPSG:2193).<BR>>  <BR>> My top level SRS is defined as EPSG:2193 (NZTM).<BR>>  <BR>> The particular OGR data source is therefore being projected to <BR>> EPSG:2193, which it seems to be doing properly.<BR>>  <BR>> The layers in the map are displaying correctly, using a number of <BR>> different clients - OpenLayers, uDig, ArcMap.<BR>>  <BR>> Now, my problem is that sending the following GetFeatureInfo request <BR>> from OpenLayers: (also tested manually via a Browser URL):<BR>>  <BR>> <A href="http://10.65.192.1/cgi-bin/gsswms.exe?service=WMS&version=1.1.1&request=GetFeatureInfo&LAYERS=apiaries_dev&QUERY_layers=apiaries_dev&FORMAT=image/png&INFO_FORMAT=gml&SRS=EPSG:2193&BBOX=1478229.486251,5375153.051004,1482462.817299,5379386.382051&WIDTH=512&HEIGHT=512&X=341&Y=19&STYLES">http://10.65.192.1/cgi-bin/gsswms.exe?service=WMS&version=1.1.1&request=GetFeatureInfo&LAYERS=apiaries_dev&QUERY_layers=apiaries_dev&FORMAT=image/png&INFO_FORMAT=gml&SRS=EPSG:2193&BBOX=1478229.486251,5375153.051004,1482462.817299,5379386.382051&WIDTH=512&HEIGHT=512&X=341&Y=19&STYLES</A> <BR>> <<A href="http://10.65.192.1/cgi-bin/gsswms.exe?service=WMS&version=1.1.1&request=GetFeatureInfo&LAYERS=apiaries_dev&QUERY_layers=apiaries_dev&FORMAT=image/png&INFO_FORMAT=gml&SRS=EPSG:2193&BBOX=1478229.486251,5375153.051004,1482462.817299,5379386.382051&WIDTH=512&HEIGHT=512&X=341&Y=19&STYLES">http://10.65.192.1/cgi-bin/gsswms.exe?service=WMS&version=1.1.1&request=GetFeatureInfo&LAYERS=apiaries_dev&QUERY_layers=apiaries_dev&FORMAT=image/png&INFO_FORMAT=gml&SRS=EPSG:2193&BBOX=1478229.486251,5375153.051004,1482462.817299,5379386.382051&WIDTH=512&HEIGHT=512&X=341&Y=19&STYLES</A>>=<BR>>  <BR>> returns the first record in the database table, regardless of the BBOX <BR>> and location parameters, which are all in terms of EPSG:2193 (NZTM).<BR>>  <BR>> Can MapServer back project the GetFeatureInfo request from EPSG:2193 <BR>> into valid NZMG (EPSG:27200) coordinates in order to request the correct <BR>> feature details via OGR?<BR><BR>Robert,<BR><BR>The problem is (likely) due to the lack of a persistent feature id when<BR>reading from ODBC.  This doesn't negatively impact drawing but completely<BR>fouls up MapServer's two pass query mechanism.<BR><BR>If you have an integer field on the source table that is a unique id,<BR>you will likely be able to mark it as the feature id using the<BR>FID element in the VRT file.  But I'm not sure if that is enough, since<BR>when the VRT asks the ODBC layer for a particular feature by fid,<BR>the ODBC driver will still do the wrong thing.<BR><BR>I see there is also a secret configure option in the ODBC driver for<BR>selecting a field as an FID.  So, if your unique integer id field<BR>was called "id", adding the following within your map should force<BR>the OGR ODBC driver to use it:<BR><BR>   CONFIG "ODBC_OGR_FID" "id"<BR><BR>Generally speaking doing MapServer queries against OGR feature<BR>datasources without persistent feature ids is problematic and<BR>should be avoided if practical.<BR><BR>Best regards,<BR>-- <BR>---------------------------------------+--------------------------------------<BR>I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com<BR>light and sound - activate the windows | <A href="http://pobox.com/~warmerdam">http://pobox.com/~warmerdam</A><BR>and watch the world go round - Rush    | President OSGeo, <A href="http://osgeo.org">http://osgeo.org</A><BR><BR>_______________________________________________<BR>mapserver-users mailing list<BR>mapserver-users@lists.osgeo.org<BR><A href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</A><BR><BR></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.<br>
------------------------------------------------------------------</td></tr></table><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc.  </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>