[Fdo-trac] [fdo-trac] #844: SQL Server provider flipping X/Y coordinates for points (SRID = 4326)

Dan Stoica dan.stoica at autodesk.com
Mon Aug 13 14:25:20 PDT 2012


Hi,

The reason for flipping the ordinates is very well explained here:

http://www.sql-server-helper.com/sql-server-2008/convert-latitude-longitude-to-geography-point.aspx/

I quote:

"As you can see from this UPDATE statement, the longitude is specified first before the latitude.  The reason is because in the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation, the format is (x, y).  Geographic coordinates are usually specified by Lat/Long but between these two, the X is the Longitude while the Y is the Latitude.

You may be wondering why the X-coordinate is the Longitude while the Y-coordinate is the Latitude.  Think of the equator of the earth as the x-axis while the prime meridian is the Y-axis.  Longitude is defined as the distance from the prime meridian along the x-axis (or the equator).  Similarly, latitude is defined as the distance from the equator along the Y-axis"

In conclusion the SqlServer provider is working correctly because is flipping X/Y coordinates both on writing and reading.



-----Original Message-----
From: FDO [mailto:trac_fdo at osgeo.org] 
Sent: Friday, August 10, 2012 2:35 AM
Cc: fdo-trac at lists.osgeo.org
Subject: Re: [fdo-trac] #844: SQL Server provider flipping X/Y coordinates for points (SRID = 4326)

#844: SQL Server provider flipping X/Y coordinates for points (SRID = 4326)
---------------------------------+--------------------------------------
---------------------------------+----
   Reporter:  jng                |       Owner:  danstoica
       Type:  defect             |      Status:  new      
   Priority:  blocker            |   Milestone:  3.7.0    
  Component:  SQLServer Spatial  |     Version:  3.7.0    
   Severity:  1                  |    Keywords:           
External_id:                     |  
---------------------------------+--------------------------------------
---------------------------------+----

Comment(by jng):

 This problem happens with any sql server geometry with an SRID in the  range of 4120 and 4999 (inclusive).

 I notice that
 [http://trac.osgeo.org/fdo/browser/branches/3.7/Providers/GenericRdbms/Src/Geometry/Fgf/AllGeometry_c.cpp#L746
 such a check is done] to determine
 [http://trac.osgeo.org/fdo/browser/branches/3.7/Providers/GenericRdbms/Src/Geometry/Fgf/AllGeometry_c.cpp#L484
 if coordinates have to be flipped]. Is there a reason we have to flip?

--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/844#comment:2>
FDO <http://fdo.osgeo.org/>
Feature Data Objects


More information about the fdo-trac mailing list