[mapserver-users] Oracle Spatial SRID mismatch fix

Rodrigo Cabral cabral at yadata.net
Sat Dec 22 13:46:13 EST 2001


Brian,

I just fixed the SRID mismatch error from the built-in SQL statement I send
to Oracle when requesting shape data. Instead of using NULL, I'm using
"table_name.geom_column.sdo_srid" so that the window SDO_GEOMETRY object has
the same SRID of your source table.

This fix means that your mapfile coordinates (e.g. extents) MUST BE in the
same coordinate system of your data. I should expand this syntax in the
future so MapServer can combine data from different coordinate systems using
Oracle's SRID built-in support (so we would use SDO's functions, not
PROJ.4).

I would appreciate if you could test the code, as I don't have any data with
a defined (not null) SRID info.

Regards,
Rod.

----- Original Message -----
From: "Rodrigo Cabral" <cabral at yadata.net>
To: "Brian McKenzie" <brian at stallingscrop.com>;
<mapserver-users at lists.gis.umn.edu>
Sent: Saturday, December 15, 2001 10:00 PM
Subject: Re: [mapserver-users] Blank image generated from oracle spatial
layer


Hey there,

Actually, I just noticed where the problem is. Let's examine this excerpt
from the error message:

[window SRID does not match layer SRID]

As you mentioned Brian, it's an SRID problem, not an indexation problem. It
occurs due to this function call (SDO_FILTER):

SDO_FILTER( GEOLOC,
MDSYS.SDO_GEOMETRY(2003, NULL,
NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(-180.3
,-179.7,179.7,180.3) ),'querytype=window') = 'TRUE'

which passes three arguments: geom1=GEOLOC; geom2=SDO_GEOMETRY constructor;
and a third non-relevant argument.

geom1 has a defined SRID, while geom2 doesn't. So we get a SRID
mismatch error. I've never tried working Spatial with defined SRIDs, so I
never got this error. I'll try to solve it soon, but meanwhile try using
this as your DATA statement in your mapfile:

DATA "GEOLOC from cnybndpl"

changes to

DATA "GEOLOC from (SELECT GEOLOC FROM cnybndpl)"

This will remove the SDO_FILTER call from the query, hence eliminating the
error. Using SELECT statement instead of a tablename makes impossible for me
to apply a "windowed" query. I reached this conclusion because when I
attempted to do so, Oracle gave me an error as I cannot use SDO_FILTER with
a geometry (the query result) that has not an index defined for it.
Consequently, MapServer will get all elements from the table, and not only
those who are within the current extent "view". This should slow the
performance a bit, but I dont think it's something you need to worry about.

Debasish, this "workaround" should make your problem go away too, in case
you decide to try working with Oracle Spatial again.

Cheers,
Rod.




More information about the mapserver-users mailing list