# NAD83 lat/long order confusion

**973154**Nov 7, 2012 10:15 PM

I am newbie to the geospatial world. I am working with data which is in NAD83, and have selected SRID 4269 as the coordinate reference system. Looking in the MDSYS.SDO_COORD_REF_SYSTEM view, this has a COORD_SYS_ID of 6422. In the MDSYS.SDO_COORD_AXES table, the North/Lat axis for 6422 has order 1 and the East/Long axis has order 2. In addition, in the MDSYS.SDO_COORD_SYS table the COORD_SYS_NAME is given as "Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: deg". All this leads me to believe that coordinates should be in lat/long order when using this CRS.

However, if I do:

SELECT SDO_GEOM.SDO_DISTANCE(

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(39.721096,-103.776314,NULL),NULL,NULL),

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(40.5,-103.85,NULL),NULL,NULL),

0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS

FROM DUAL

I get 22.3370028351841 which is wrong. Whereas, if I present the coordinates in long/lat order:

SELECT SDO_GEOM.SDO_DISTANCE(

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(-103.776314,39.721096,NULL),NULL,NULL),

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(-103.85,40.5,NULL),NULL,NULL),

0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS

FROM DUAL

I get 86.7148255311137, which is correct (thanks to whomever asked a similar question on here and left the answer that they figured out they needed to reverse the coordinates).

Clearly, I need to use long/lat ordering for coordinates when using this system, but what did I miss that indicates that that is the order to use? Is there an alternative SRID to use? I am working with the JTS, GeoTools, and Hibernate Spatial libraries in Java and working with polygons as well as points, so I am looking for a consistent and efficient way of working with these coordinates.

Thanks,

Marc

However, if I do:

SELECT SDO_GEOM.SDO_DISTANCE(

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(39.721096,-103.776314,NULL),NULL,NULL),

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(40.5,-103.85,NULL),NULL,NULL),

0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS

FROM DUAL

I get 22.3370028351841 which is wrong. Whereas, if I present the coordinates in long/lat order:

SELECT SDO_GEOM.SDO_DISTANCE(

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(-103.776314,39.721096,NULL),NULL,NULL),

SDO_GEOMETRY(2001,4269,SDO_POINT_TYPE(-103.85,40.5,NULL),NULL,NULL),

0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS

FROM DUAL

I get 86.7148255311137, which is correct (thanks to whomever asked a similar question on here and left the answer that they figured out they needed to reverse the coordinates).

Clearly, I need to use long/lat ordering for coordinates when using this system, but what did I miss that indicates that that is the order to use? Is there an alternative SRID to use? I am working with the JTS, GeoTools, and Hibernate Spatial libraries in Java and working with polygons as well as points, so I am looking for a consistent and efficient way of working with these coordinates.

Thanks,

Marc