Hi everyone,
I'm having trouble retrieving the latitude and longitude data from a kml file using a small android app. It keeps returning latitude = 0.0 and longitude = 0.0. I'm pretty sure that i've pushed the kml file properly to the emulator (no extension, file name is "kml", has properties file, and is stored under misc/location/mygps/).
Any help/advice will be greatly appreciated. Thanks!
-androidonkey
Here is the app:
LocationManager lm = (LocationManager)getSystemService(LOCATION_SERVICE);
Location l = lm.getCurrentLocation("mygps");
String longitude = l.getLongitude() + "";
String latitude = l.getLatitude() + "";
String CurrentLat = latitude;
String CurrentLong = longitude;
And here are the contents of the KML file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>1065 Brea Mall, Brea, CA 92821.kml</name>
<StyleMap id="default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png">
<Pair>
<key>normal</key>
<styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
</Pair>
</StyleMap>
<Style id="default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon52.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>1.1</scale>
</LabelStyle>
</Style>
<Style id="default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon60.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>1065 Brea Mall, Brea, CA 92821</name>
<address>1065 Brea Mall, Brea, CA 92821</address>
<LookAt>
<longitude>-117.883593</longitude>
<latitude>33.916991</latitude>
<altitude>0</altitude>
<range>1000</range>
<tilt>0</tilt>
<heading>0</heading>
</LookAt>
<styleUrl>#default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
<Point>
<coordinates>-117.883593,33.916991,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>





