2 Replies Latest reply: Apr 3, 2012 11:02 AM by Paul Dziemiela RSS

    SDO_BUFFER does some very odd things

    Paul Dziemiela
      Hi folks,
      Using 11.2.0.3.

      I was writing some front-end tests for a service that accepts geometry inputs. Sometimes we have folks submitting Web Mercator geometries mislabeling them as geodetic. Now Oracle Spatial validation does not seem to care if geodetic data is actually on the earth but simple enough to test if an input is outside the -180/-90 bounds. However I have a service that accepts a point and then buffers it and I thought I'd just look at the buffer to check that its on the earth. So this came to light.

      Given a quite reasonable Web Mercator point, we can mislabel it as NAD83 but it still validates nicely.
      SELECT 
      SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(
         SDO_GEOMETRY(2001,8265,SDO_POINT_TYPE(-9778922.562372, 5219660.84450598,NULL),NULL,NULL),
         0.05
      ) FROM dual;
      However, if I take this "offworld alien" point and buffer it by 10KM, I get a nice geodetic polygon in the South China Sea!
      SELECT
      SDO_GEOM.SDO_BUFFER(
         SDO_GEOMETRY(2001,8265,SDO_POINT_TYPE(-9778922.562372, 5219660.84450598,NULL),NULL,NULL),
         10,
         0.05,
         'UNIT=KM'
      ) FROM dual
      Can anyone take a stab at that? I thought perhaps I had stumbled upon Dr. Ravada and his team's volcano island hideout but the polygon moves about as you change the inputs. Anyhow its a weird one and I will be moving my tests up in front of the buffer step.

      Cheers,

      Paul
        • 1. Re: SDO_BUFFER does some very odd things
          matt schell
          Hi Paul,

          Are we supposed to be taking a stab at locating the island hideout or figuring out what's going on with the buffer?

          On the latter, I think the geodetic coordinate systems just keep wrapping the earth around and around again as you go past +/- 180/90. I'd translate your longitude, for example, as

          1. Go to -180, the dateline
          2. Then go around X number of 360s
          3. Then stop -62 degrees west of the dateline

          Or

          select MOD(-9778922.562372,360) + 360 from dual
          -->117

          Similarly

          select MOD(5219660, 360) from dual
          --> 20

          There he is: http://www.wholesalehalloweencostumes.com/ELX9200-adult-wheres-waldo-kit.html

          Matt
          • 2. Re: SDO_BUFFER does some very odd things
            Paul Dziemiela
            Indeed!

            Solves it for me though perhaps here is a better illustration
            http://xraytrader.com/assets/images/Spinning_Globe.JPG

            Thanks Matt!

            Paul