views:

20

answers:

2

Hi everyone. Does anyone know how to display points, lines etc. (basically every overlay) created in android in standard google maps on website? The android db is synchronized with remote db. I'm getting the points from the database, creating kml file from them and uploading in to the map. The problem is that the areas I've created are not appearing where they should. They're somewhere on the ocean. I thought that's because I'm running this code in android:

Double lat = location.getLatitude()*1E6;
Double lng = location.getLongitude()*1E6;

So basically I'm doing microdegrees here. I thought that dividing lat and long from db by 1E6 would do the trick but it didn't. Can someone please help me on that one? Thanks in advance.

+1  A: 

I don't know which format is expected by the map. If it is normal coordinates, then I guess you would need to do:

float lat = ((float)location.getLatitude()) / 1E6;

Otherwise, if it is expecting it in int format, you don't need to do anything

P.S. Assuming getLatitude() returns an int, the cast to float is important. Otherwise 4539845 will become 45 and not 45.39845

Itsik
A: 

I agree with ltsik, the E6 format is basically the regular latitude multitplied by 1E6 (or 1,000,000 whichever one you prefer) so it makes perfect sense that the variables lat and lng are obtained by dividing and not multiplying

arclight