<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.24">
<TITLE>RE: [UMN_MAPSERVER-USERS] Problem with Mapserver Virtual Spatial Data (ogr)</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>OGR tries to automatically detect the primary key of a table. This does not always work automatically. The reason could be for instance the data type used for your primary key, or maybe a small flaw in the driver's code. Another example, using ODBC on Access, there is trouble detecting the primary key because of a not implemented ODBC function in the Microsoft driver. </FONT></P>

<P><FONT SIZE=2>Best regards,</FONT>
<BR><FONT SIZE=2>Bart</FONT>
</P>

<P><FONT SIZE=2>-----Oorspronkelijk bericht-----</FONT>
<BR><FONT SIZE=2>Van: UMN MapServer Users List</FONT>
<BR><FONT SIZE=2>[<A HREF="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">mailto:MAPSERVER-USERS@LISTS.UMN.EDU</A>]Namens Christian Wilmes</FONT>
<BR><FONT SIZE=2>Verzonden: vrijdag 19 mei 2006 8:40</FONT>
<BR><FONT SIZE=2>Aan: MAPSERVER-USERS@LISTS.UMN.EDU</FONT>
<BR><FONT SIZE=2>Onderwerp: Re: [UMN_MAPSERVER-USERS] Problem with Mapserver Virtual</FONT>
<BR><FONT SIZE=2>Spatial Data (ogr)</FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi Frank,</FONT>
</P>

<P><FONT SIZE=2>thank you very much for your help!</FONT>
</P>

<P><FONT SIZE=2>With the line</FONT>
<BR><FONT SIZE=2>CONFIG &quot;PGSQL_OGR_FID&quot; &quot;fieldname&quot; </FONT>
<BR><FONT SIZE=2>in the Map section everything works very well.</FONT>
</P>

<P><FONT SIZE=2>But now I've still got one more question, just an understanding one. I've got testet the &quot;Virtual Spatial Data&quot; with a MySQL Database a few days ago and there everything works well without a line like that. Where could be the reason?</FONT></P>

<P><FONT SIZE=2>Best Regards</FONT>
<BR><FONT SIZE=2>Christian</FONT>
</P>
<BR>

<P><FONT SIZE=2>-------- Original-Nachricht --------</FONT>
<BR><FONT SIZE=2>Betreff: Re: [UMN_MAPSERVER-USERS] Problem with Mapserver Virtual Spatial Data (ogr)</FONT>
<BR><FONT SIZE=2>Datum: Thu, 18 May 2006 16:55:40 -0400</FONT>
<BR><FONT SIZE=2>Von: Frank Warmerdam &lt;warmerdam@POBOX.COM&gt;</FONT>
<BR><FONT SIZE=2>An: MAPSERVER-USERS@LISTS.UMN.EDU</FONT>
</P>

<P><FONT SIZE=2>&gt; Christian Wilmes wrote:</FONT>
<BR><FONT SIZE=2>&gt; &gt; Hello,</FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; first of all sorry for cross posting, but I've got no idea where I have</FONT>
<BR><FONT SIZE=2>&gt; to</FONT>
<BR><FONT SIZE=2>&gt; &gt; search the mistake so I post it to the GDAL and the Mapserver</FONT>
<BR><FONT SIZE=2>&gt; Mailinglist.</FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; I'm trying to publish a WFS-Server. The Data (only Point-Data) are in a</FONT>
<BR><FONT SIZE=2>&gt; &gt; PostgreSQL-Database (no PostGIS!). So the connection to the data is over</FONT>
<BR><FONT SIZE=2>&gt; &gt; &quot;Virtual Spatial Data&quot;. The getCapabilities and DescribeFeatureType</FONT>
<BR><FONT SIZE=2>&gt; request</FONT>
<BR><FONT SIZE=2>&gt; &gt; both work very well. Only the GML-Document getting with the getFeature</FONT>
<BR><FONT SIZE=2>&gt; &gt; request is not correct. The number of features in the GML-Document are</FONT>
<BR><FONT SIZE=2>&gt; &gt; correct too every time, but the features are not in the Bounding Box.</FONT>
<BR><FONT SIZE=2>&gt; The</FONT>
<BR><FONT SIZE=2>&gt; &gt; features in the GML-Document are always the feature which are on the top</FONT>
<BR><FONT SIZE=2>&gt; of</FONT>
<BR><FONT SIZE=2>&gt; &gt; the table they come from. Only the number of feature is correct. The MBR</FONT>
<BR><FONT SIZE=2>&gt; &gt; (Minimum Boundig Rectangle) on the top of the GML-Document amasingly the</FONT>
<BR><FONT SIZE=2>&gt; &gt; correct one. So it don't fit to the features in the document. Testing</FONT>
<BR><FONT SIZE=2>&gt; the</FONT>
<BR><FONT SIZE=2>&gt; &gt; connection with &quot;ogrinfo&quot; and a Boundig-Box is working correct. If I'm</FONT>
<BR><FONT SIZE=2>&gt; &gt; trying to make a WMS-Server with the same Data and the same OGR-file it</FONT>
<BR><FONT SIZE=2>&gt; &gt; works very well.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Christian,</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; I believe the problem is that OGR is not successfully identifying a column</FONT>
<BR><FONT SIZE=2>&gt; in the table to use as a &quot;feature id&quot;.&nbsp; For WFS queries the results are</FONT>
<BR><FONT SIZE=2>&gt; fetched in two passes for various historical reasons.&nbsp; The first pass</FONT>
<BR><FONT SIZE=2>&gt; results in a fetch of the feature ids of the features, and the second</FONT>
<BR><FONT SIZE=2>&gt; pass fetches features by id.&nbsp; Unfortunately, if OGR cannot select a good</FONT>
<BR><FONT SIZE=2>&gt; unique feature id column, then it assigns them serially.&nbsp; The first pass</FONT>
<BR><FONT SIZE=2>&gt; has the spatial query &quot;in place&quot; so the resulting fids are 1, 2, 3, etc.</FONT>
<BR><FONT SIZE=2>&gt; But the second pass does not have the spatial filter in place, so it ends</FONT>
<BR><FONT SIZE=2>&gt; up returning the wrong features.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Ideally you would ensure you have a single integer column setup as a</FONT>
<BR><FONT SIZE=2>&gt; primary index for your postgres table.&nbsp; If that is the case it *should*</FONT>
<BR><FONT SIZE=2>&gt; get used as the fid.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; If not, you may be able to include the following line in your MAP file</FONT>
<BR><FONT SIZE=2>&gt; (in the MAP section, not the layer):</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp; CONFIG &quot;PGSQL_OGR_FID=fieldname&quot;</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; to indicate what fieldname should get used as FID.&nbsp; This should be</FONT>
<BR><FONT SIZE=2>&gt; available with GDAL/OGR 1.3.2.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; PS. the much talked about one-pass-query would resolve this problem.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Good luck,</FONT>
<BR><FONT SIZE=2>&gt; -- </FONT>
<BR><FONT SIZE=2>&gt; ---------------------------------------+--------------------------------------</FONT>
<BR><FONT SIZE=2>&gt; I set the clouds in motion - turn up&nbsp;&nbsp; | Frank Warmerdam,</FONT>
<BR><FONT SIZE=2>&gt; warmerdam@pobox.com</FONT>
<BR><FONT SIZE=2>&gt; light and sound - activate the windows | <A HREF="http://pobox.com/~warmerdam" TARGET="_blank">http://pobox.com/~warmerdam</A></FONT>
<BR><FONT SIZE=2>&gt; and watch the world go round - Rush&nbsp;&nbsp;&nbsp; | President OSGF, <A HREF="http://osgeo.org" TARGET="_blank">http://osgeo.org</A></FONT>
</P>

<P><FONT SIZE=2>-- </FONT>
</P>
<BR>

<P><FONT SIZE=2>Bis zu 70% Ihrer Onlinekosten sparen: GMX SmartSurfer!</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Kostenlos downloaden: <A HREF="http://www.gmx.net/de/go/smartsurfer" TARGET="_blank">http://www.gmx.net/de/go/smartsurfer</A></FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; </FONT>
</P>

<BR>


Disclaimer
************************************************************************
Aan dit bericht kunnen geen rechten worden ontleend. Dit bericht is
uitsluitend bestemd voor de geadresseerde. Als u dit bericht per abuis
hebt ontvangen, wordt u verzocht het te vernietigen en de afzender te 
informeren. Wij adviseren u om bij twijfel over de juistheid of de 
volledigheid van de mail contact met afzender op te nemen.

This message shall not constitute any rights or obligations.
This message is intended solely for the addressee.
If you have received this message in error, please delete it and
notify the sender immediately. When in doubt whether this message
is correct or complete, please contact the sender.
************************************************************************

<BR>
</BODY>
</HTML>