OGR ODBC spatial query has invalid resultset

Fabio D'Ovidio dovidio at PLANETEK.IT
Tue Sep 26 06:19:46 PDT 2006


Frank, please, what is wrong with this ??

LAYER
  NAME "pug2_iffi"
  TYPE POINT
  STATUS ON
  TEMPLATE  "query.html"
  TOLERANCEUNITS  PIXELS
  TOLERANCE 1000
  CLASS
    NAME "Pug2_iffi"
    # TEMPLATE
    STYLE
    SYMBOL  "circlefd"
    SIZE 7
    COLOR  127 255 0  
    OUTLINECOLOR 0 0 0
   END
  END
  PROJECTION
		#Lat/Lon
		"init=EPSG:32633"
	END
	CONNECTIONTYPE OGR
  CONNECTION "puglia/pug_iffi.shp"
 DATA "SELECT * from pug_iffi c LEFT JOIN 'ODBC:sa/@CartanetIFFI'.Query_IdFrana b 
ON c.IDFRANA = (b.cod_pro + b.id + b.subid)"
  END

It doesn't work !

On 26 Sep 2006 at 9:07, Frank Warmerdam wrote:

> 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, warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | President OSGeo, http://osgeo.org


********************************************************************************************


 Ing. Fabio D'Ovidio
 WebGIS Staff
 Planetek Italia Srl
 via Massaua, 12 - 70123 Bari - Italy
 web : http ://www.planetek.it
 e-mail : dovidio at planetek.it

********************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060926/ca09bc44/attachment.htm>
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  planetek.gif
     Date:  28 Feb 2006, 16:15
     Size:  1899 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: planetek.gif
Type: application/octet-stream
Size: 1899 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060926/ca09bc44/attachment.obj>


More information about the MapServer-users mailing list