Hi Frank, Thanks a lot for that. It works great. That's really saved my neck.
Regards, Jacob > -----Original Message----- > From: Frank Warmerdam [mailto:[EMAIL PROTECTED] > Sent: 26 September 2006 21:08 > To: Delfos, Jacob > Cc: [email protected] > Subject: Re: [UMN_MAPSERVER-USERS] OGR ODBC spatial query has > invalid resultset > > Delfos, Jacob wrote: > > Hi List, > > > > Sorry about all the questions I have been sending. I'm > hoping someone > > can shed light on this one. > > > > After a QueryByPoint or QueryByRect operation in PHP, the number of > > results is correct, but the resultCacheMemberObj always > points to the > > first "getNumResults()" objects. If there are 4 results, it holds > > references to objects 1-4. For one result, it always points > to the 1st > > object. > > > > This is -not- the case for QueryByAttributes, though. The > > resultCacheMemberObj is correct for this type of query. > > > > This only occurs for OGR ODBC layers. I have tried MDB and > CSV, with the > > same problem... > > > > If anyone knows why, please let me know. If someone thinks > this is a > > bug, I'll file it. > > Jacob, > > This occurs with OGR ODBC datasources that lack an FID column > in the original > table. Without an FID, OGR just assigns FIDs starting with > zero to the > result set. > > The problem really bites when different constraints (spatial > or attribute) > are in place at the point where the query is done, and when > the results are > fetched - which is the case when you do spatial queries as > the spatial query > apparently is cleared by mapserver before it starts fetching > individual > results. > > The overall point is that two-stage queries (as done by mapserver) are > very unreliable against OGR datasources without a persistent > FID, such as > some ODBC datasources. > > BTW, you can use the mapserver config variable ODBC_OGR_FID > to force the > ODBC driver to pick a particular column as the FID. > Unfortunately this > is a global option so it only works smoothly if you have the same name > for the id of all tables you are accessing in a given > mapserver map. You > would add something like the following in the MAP section of > your map file > to default to using the ID column of your odbc tables as the > feature id. > > CONFIG "ODBC_OGR_FID" "ID" > > Best regards, > -- > ---------------------------------------+---------------------- > ---------------- > I set the clouds in motion - turn up | Frank Warmerdam, > [EMAIL PROTECTED] > light and sound - activate the windows | http://pobox.com/~warmerdam > and watch the world go round - Rush | President OSGeo, > http://osgeo.org > >
