I need to convert wgs84 values into latitude and longitude values. I need to convert values into latitude and longitude and drop a pin on mapview. For example in plist i have got values SDO_X1= 39616.4535 and SDO_Y1=37472.9078, How do i convert these values into degree,radians or latitude and longitude, please help me. All locations are for Singapore
Re "values SDO_X1= 39616.4535 and SDO_Y1=37472.9078".
Knowing that these are based on "WGS-84" is not enough information to answer the question. They are not "WGS84 values", because "WGS84 values", in decimal form, would be degrees decimal, e.g. -180 to +180 in X, -90 to +90 in Y.
Judging by the size of the values, they are probably measurements in meters, relative to some reference point.
Googling, I see that the official projection for Singapore is known as "SVY21".
CAVEAT: Unless these are from a land survey prior to 2004, in which case you need to ask a local land surveyor or appropriate government official to help you convert these. Or any reference source that provides the table or formula for these older surveys.
Assuming these are SVY21 values, then see the answer to Easting northing to latitude longitude
Related
I write new locations with:
ST_SetSrid(ST_MakePoint(:longitude, :latitude), 4326)
They get saved under "profile".location:
SRID=4326;POINT(-75.1234 35.1234)
I try to filter profiles within some :radius in meters where :ownLocation is some location string that consists of a bunch of numbers:
ST_DWithin("profile".location, :ownLocation::geometry, :radius)
Then when I get the results back and calculate their distance with:
ST_Distance(
ST_Transform("profile".location::geometry, 3857::int), ST_Transform(:ownLocation::geometry, 3857::int)
) as distance
and convert the distance from meters to miles, my results are a bit off. Let's say I set a max radius of within 10 miles - the distance I get back seems anywhere from 0-23 miles (would expect 0-10 miles).
I am wondering where I am going wrong here, and have a feeling it may have to do with projections, or I am using the functions incorrectly.
Update after solution: store as 4326, display distance as 3857
store as 4326:
ST_SetSrid(ST_MakePoint(:longitude, :latitude), 4326)
filter using geography type so it can accept filter radius as meters that users will pass in:
ST_DWithin("profile".location::geography, :ownLocation::geography, :radiusInMeters)
display distance from 4326 to 3857 meters with correction (https://postgis.net/docs/ST_Distance.html):
ST_Distance(
ST_Transform("profile".location::geometry, 3857),
ST_Transform(:ownLocation::geometry, 3857)
) * cosd(42.3521) as distance
3857 is not suitable for computing distances, as it introduces important distortions as you move away from the equator.
Instead, you can use ST_Distance using the geography datatype:
ST_Distance("profile".location::geography,:ownLocation::geography) as distance
Regarding st_dwithin, it uses the projection unit, which is degrees, not meters. You can also use the geography datatype here.
The unit of EPSG 4326 is degrees whereas the unit of EPSG 3857 is meters.
ST_DWithin("profile".location, :ownLocation::geometry, :radius) will take degrees as radius not meters or miles.
Transform "profile".location and :ownLocation::geometry to 3857 should work;
Why PostGIS does not validate the longitude and latitude for a GEOMETRY field when we try to save values with latitude greater than 90 (latitude > 90)?
Take a look at this picture:
You can see that the latitude value ranges between [-90, 90].
Theoretically you can have latitude > 90 or < -90 but that will correspond to an equivalent coordinate with an inverse longitude.
That would possibly lead to the creation of 2 or more different entries with the same coordinates, thus PostGIS does not validate latitude outside of the [-90, 90] range.
I am trying to plot missing countries on the Highmaps world high resolution map. However it is difficult to get the correct co-ordinates.
It appears this may be difficult because the charts do not correspond with latitude and longitude. For example world high-resolution has 1750 points on the X axis, so half is 875, but GMT is at about 839.
Ideally I am looking for a formula that can be used to convert latitude and longitude to x/y, but do not know how to do this.
I got these values from server:
<gps_n>34.22.123</gps_n>
<gps_w>81.59.345</gps_w>
I would like to convert these values to latitude/longitude in Objective C. Would you please give me a guide to do this?
Thanks
The formula for both lat/long (n/w) is:
Degrees+(minutes/60)+(seconds/3600)
From this page:
http://webmaster10.com/ldr/lat-long-conversion.html
The example you have given, already are latitude/longitude coordinates. There are many such lat,lon formats, what you want are lat/long coordinates in decimal degrees, probably with a sign to denote N/S or E/W.
Use the formula above: (Degrees+(minutes/60)+(seconds/3600))
and multiply latitude with -1 when S is given.
Multiply longitude by -1 when "W" is given.
I am working on a tool to find the distance between two points whose latitude and longitude are given. Its ok when the latitude and longitude is given in Signed Degree Format. But I couldn't find a way to calculate the distance when latitude and longitude is given in Degree Minutes Seconds Format (ex: N 11° 14' 52').Can anybody suggest me a way to find the distance ?
So first convert the DMS coordinates to your degree format.
e.g. 11°14'52" = 11 + 14/60 + 52/3600 = 11.24777778 degrees
and then continue as you did with your destance calculation that you say already works.
Edit:
Note that latitudes in the southern hemisphere and longitudes in the western hemisphere are negative. So the above formula really should be:
sign(degrees) * (abs(degrees) + minutes/60 + seconds/3600)