Reputation: 381
I'm working on building a database for a geo referenced application which involves storing of latitude, longitude and altitude. The column to store the same is location
and is declared as location geography(PointZ,4326)
.
I insert the points in the following manner
INSERT INTO SOMETABLE VALUES (ST_GeographyFromText('SRID=4326;POINT("+loc+")');
, where loc
is a space seperated string with the latitude , longitude and altitude values (for example 2.098 5.67 3.45).
I did not find any aberration until I inserted a specific geographical point 19.4333 99.1333 2200
, which on retrieval becomes 19.433299999999999 80.866699999999994 2200
. My concern is about the second coordinate point changing while storing.
Could someone advise me on what's the issue.
I appreciate your help!!
Thanks.
Upvotes: 0
Views: 1152
Reputation: 381
I had figured out what the issue was myself when I tried to understand the specifics of ST_GeographyFromText()
It takes in coordinates in this order - [longitude, latitude, altitude] and I had misordered latitude and longitude and as a matter of fact, the maximum value for latitude is 90 and that's the reason the 99.1333
was altered to 80.86669
( a value less than 90 ).
Thanks!
Upvotes: 1