0 Replies Latest reply on Jul 23, 2018 12:14 PM by Rick J

    JSON to SDO_GEOMETRY truncates coordinates.

    Rick J

      I am developing a REST API with ORDS 18.2 and Oracle 12.2.  One of the columns being populated is a sdo_geometry.    The input is geojson.    The POST succeeds however the resulting coordinates are truncated to whole numbers.  Running the same pl/sql outside of ORDS does not reproduce the problem.

       

      For example the following SQL produces the correct results.

       

      SQL> select boundary

        2  from json_table('{"type":"Polygon","coordinates":[[[-122.1,37.2],[-122.1,37.3],[-122.2,37.3],[-122.2,37.2],[-122.1,37.2]]]}', '$'

        3  columns( boundary sdo_geometry path '$'));

       

       

      BOUNDARY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)

      --------------------------------------------------------------------------------

      SDO_GEOMETRY(2003, 4326, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR

      AY(-122.1, 37.2, -122.1, 37.3, -122.2, 37.3, -122.2, 37.2, -122.1, 37.2))

       

      However if the same query is used in a GET handler then the following json is returned

       

       

      { "items": [ { "boundary": { "rsid": "urn:ogc:def:crs:EPSG::4326", "srid": 4326, "polygon": { "boundary": [ { "line": { "datapoints": [ [ -122, 37 ], [ -122, 37 ], [ -122, 37 ], [ -122, 37 ], [ -122, 37 ] ] } } ] } } } ],

       

       

      Am I doing something wrong here?