Hi all,
 
I have inserted polygon objects into an Oracle Spatial table, say REGION_TABLE, 
using pre-known vertex coordinates with C# code. My main purpose is to get 
whether some point is within a specific polygon (region) object or not. First, 
I have inserted a region object via the following code:
 
com.CommandText = "INSERT INTO ATS.REGION_TABLE (REGION_ID, REGION_NAME, 
GEOLOC) " + "VALUES(1,"TEST REGION","MDSYS.SDO_GEOMETRY (2003,8307, NULL, 
MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1), MDSYS.SDO_ORDINATE_ARRAY(" + 
    coordStream + ")))";
    
where the C# variable "coordStream" holds the vertex coordinates.
 
The problem is that when I perform a spatial query like the following, the 
return value, namely REGION_NAME, sometimes gives wrong results, ie does not 
return the correct region name of the point which is included by the region:
       
com.CommandText = "select REGION_NAME from REGION_TABLE where 
sdo_relate(GEOLOC, mdsys.sdo_geometry(2001, 8307, mdsys.sdo_point_type(" + lon 
+ "," + lat + ", null), null, null), 'mask=anyinteract querytype=window') = 
'TRUE'";
 
where lat and lon are lattitude and longitude values of the point respectively.
 
When I use the same spatial query in a regular Oracle Spatial table (in CITIES 
table for example) it gives always correct results. Wrong results appear only 
in the REGION_TABLE whose polygons are inserted via spatial insert statement as 
I mentioned above.
 
When I compared the REGION_TABLE records with a regular Oracle Spatial table 
(say, a CITIES table which is uploaded via EasyLoader) I have seen only 2 
differences: GEOLOC.SDO_POINT.X and GEOLOC.SDO_POINT.Y values of the 
REGION_TABLE are null, but the CITIES table's are not. This is just an 
observation, ie I don't know whether the problem is related with this. What is 
the cause of the problem and what is the solution? Any comments are welcome.

                
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

Reply via email to