convert wgs 84 to lat/long

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 13:51:20

问题


Hi I am having a little trouble figuring out how to convert between types of coordinates. I have a list of coordinate sets with the following description

"Coordinates are always in the WGS84 system. All coordinates a represented as integer values x and y where the coordinate value is multiplied with 1,000,000."

An example: 559262 6319512

Well, I need to convert these to long/lat (and back) so i can use these in google maps (android). But this is not as easy as it seams. I have been searching around and did find some code to do this, but it does not seam to work properly. Anyone who can provide some code for doing this? If possible, I would like to avoid a big geo framework (it has to be used in an android application).

thanks.

best regards, kenneth

EDIT: I did find a solution on my own. I downloaded the class described here: http://www.ibm.com/developerworks/java/library/j-coordconvert/

And it works fine. Hope someone can find it useful.

I am sorry for posting before having done my homework decently. Thanks to everyone who posted


回答1:


If you're getting the location from the GPS on android, you will get a Location object that holds Lat/Long as doubles. In order to display a point on Google Maps, you need to turn these double values into a GeoPoint object using:

GeoPoint location = new GeoPoint(
            (int) (mLocation.getLatitude()) * 1E6), 
            (int) (mLocation.getLongitude()) * 1E6)
                     );

Hope thats helpful.




回答2:


All GPS systems give their latitude and longitude with respect to the WGS84 model of the Earth. Unless you intend to give the lat/lon with respect to a nation's local model, such as the British OSGB36 model, you should be fine treating the coordinates you have as representing microdegrees. Even here in the Britain, the Admiralty now print their nautical charts with lat/lon relative to WGS84, I expect the Ordnance Survey land maps will follow suit soon, if they haven't already done so.



来源:https://stackoverflow.com/questions/5625386/convert-wgs-84-to-lat-long

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!