Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get E6 format of Longitude Latitude for Google Maps on Android

how do i find out the SPECIFIC E6 values of longitude latitude of a location. For example, i googled for long-lat of Asuncion, the capital city of Paraguay. It returns me:

The latitude and longitude of Asuncion, Paraguay is 25°16' S, 57°40 W

Now how do i convert THIS format of long-lat into E6 format of long-lat which android understands? What exactly IS THIS E6 thing?

[p.s. i also googled for E6 long-lat of Asuncion....... with no luck]

like image 531
Rakib Avatar asked Aug 13 '11 10:08

Rakib


People also ask

How do I set latitude and longitude on Android?

Select Location > Then set the Latitude and Longitude values. Then press Send to set the Latitude and Longitude values to the emulator device.

Is there a latitude longitude app for Android?

Use the Google Maps Mobile App to Find Coordinates You can also use the Google Maps mobile app for Android, iPhone, and iPad to locate the exact GPS coordinates for any location worldwide.

How do I share latitude and longitude in Google Maps on Android?

Google Maps will present a small pop-up on the bottom of the screen with your location. Pull up on that pop-up menu. Next to a marker icon you'll see the Plus Code (above your longitude and latitude.) Copy and paste that and send it to a friend to give them your current location.

What format does Google Earth use for coordinates?

KML is a file format used to display geographic data in an Earth browser such as Google Earth.


2 Answers

So it's a two step process - thanks to hooked82's answer


step 1. Conversion from DMS to Decimal Degrees From Wikipedia

Given a DMS (Degrees, Minutes, Seconds) coordinate such as 87°43′41″ W, it's trivial to convert it to a number of decimal degrees using the following methods:

  • Total number of degrees
    = 87
  • Total number of seconds
    = 43′41″ = (43*60 + 41*1) = 2621 seconds.
  • The fractional part is total number of seconds divided by 3600
    = 2621 / 3600 = 0.728056
  • Add fractional degrees to the whole degrees to produce the final result
    = 87 + 0.728056 = 87.728056.
  • Since it is a West longitude coordinate, negate the result.
    = -87.728056.
  • Long-Lat reference:

    Lat.  North = +
    Lat.  South = -
    Long. East  = +
    Long. West  = -
    

    step 2. Conversion from Decimal Degrees to MicroDegrees (the E6 format) From SO discussion

    MicroDegrees (the E6 format) = DecimalDegrees * 1e6
    --- as mentioned in AndroidDevGuide as well

    thus,

    float lat   = -23.4456f;   //in DecimalDegrees
    float lng   = 45.44334f;   //in DecimalDegrees
    GeoPoint gp = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6));
    
    like image 175
    Rakib Avatar answered Sep 19 '22 20:09

    Rakib


    I'm not sure of a programmatic approach to converting a DMS Coordinate to Microdegrees, but there is a manual conversion process which I came across at:

    http://en.wikipedia.org/wiki/Geographic_coordinate_conversion#Conversion_from_DMS_to_Decimal_Degree

    Also, take a look at this SO question:

    Android GeoPoint with lat/long values

    If you're manually trying to get GPS coordinates and want values that Android can handle, you can always go to Google Maps and Right-Click on a point on the map and select "What's Here". It will give you the lat/long of that position, though there are many ways of getting these.

    like image 20
    hooked82 Avatar answered Sep 22 '22 20:09

    hooked82