Searching by bounding box with lat-long giving me weird results
596866Oct 2 2007 — edited Oct 5 2007I'm doing a spatial query to get certain objects within a bounding box:
SELECT order_id, sdo_cs.transform (area, 8307)
FROM ors_outage_polygon p
WHERE p.area IS NOT NULL
AND sdo_filter (p.area,
ors_spatial.bounding_box (-145.5029296875, 49,
-114.74121093750001, 60.21799073323445
), 'QUERYTYPE=WINDOW') = 'TRUE';
The stored proc ors_spatial.bounding_box creates a rectangle geometry and converts it to our custom coordinate system (A lambert conformal system centred around BC). The parameters are longitude, latitude.
There's a lot of valid data in this table -- we know because we've rendered them on Virtual Earth and it matches up with our existing GIS. But this query will return 1 record. I reduce the first parameter from -145 to -125 and I get all the records I expect. What the heck...?
This method and query worked before in smaller areas. It's only when we went to this larger bounding box that we get this problem. My first guess is something's going funky with the coordinate conversion, but when I do a select dual with my bounding box proc above, the box returned seems reasonable and seems to match our data.
Feel free to ask for more information -- I'm not sure what's going on here, so I didn't know what info to provide.