kml file

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

kml file

Postby vishakha » Thu May 12, 2011 7:56 am

Hi All,

I am working on geolocation application.In that I want to draw route between two geopoints on mapview.
I am implementing it as given in following link http://stackoverflow.com/questions/3109 ... g-kml-file but I am not getting kml file from google in android code. When I am executing google api in browser then it ask to save it but in coding its not giving . While executing this code it throws exception like "org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: no element found" that means it's not getting file itself. Please give me better way to draw the path on mapview .


Thanks ,
Vishakha
vishakha
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Oct 30, 2010 10:10 am

Top

Re: kml file

Postby mathias.lin » Thu May 12, 2011 8:15 am

Hi, I'm the one who posted the accepted reply on the above mentioned StackOverflow link. You should check the http response you're getting and log it to logcat, see what it says (can use HttpClient class for it for example).
Maybe you're not using the right URL (one that actually returns kml data in xml format). What's the url you're requesting?
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Re: kml file

Postby vishakha » Thu Jun 09, 2011 11:19 am

Hi ,

I am using "http://maps.google.com/maps?f=d&hl=en&saddr=19.07091802,72.83965352&daddr=19.0384,72.8420&ie=UTF8&0&om=0&output=xml" this link to get kml file from google.

Thanks,
Vishakha.
vishakha
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Oct 30, 2010 10:10 am

Re: kml file

Postby mathias.lin » Fri Jun 10, 2011 6:19 pm

Use output=kml instead of output=xml as the last parameter, then it should work.
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Re: kml file

Postby vishakha » Mon Jun 13, 2011 1:29 pm

Yes , I have tried by replacing output=kml to output=xml and this response is not proper as given in tutorial . There are no info about geopoints.It,s very different file.What can be the reason for that kml is not fetched? Is there any other way to draw route on map between two geopoints.

Thanks,
Vishakha.
vishakha
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Oct 30, 2010 10:10 am

Re: kml file

Postby Rommy » Tue Jun 14, 2011 6:22 am

mathias.lin wrote:Use output=kml instead of output=xml as the last parameter, then it should work.

Hi, Mathias...
I've read your solution in that site...
Do you know how to get a distance between two Geopoints based on the KML you explained before??

I've known how to calculate a distance between 2 Geopoints in case of when it's a straight line.
But I still don't know how to find it if in Direction Mode, I mean when there's right or left turn the result will be different right?

If I try the first option, the result will not be valid..
So I think I have to get a value from that kml...
Do you have any idea??
Rommy
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Oct 19, 2010 10:21 am

Top

Re: kml file

Postby Rommy » Tue Jun 14, 2011 6:28 am

mathias.lin wrote:Use output=kml instead of output=xml as the last parameter, then it should work.

Hi, Mathias...
I've read your solution in that site...
Do you know how to get a distance between two Geopoints based on the KML you explained before??

I've known how to calculate a distance between 2 Geopoints in case of when it's a straight line.
But I still don't know how to find it if in Direction Mode, I mean when there's right or left turn the result will be different right?

If I try the first option, the result will not be valid..
So I think I have to get a value from that kml...
Do you have any idea??
Rommy
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Oct 19, 2010 10:21 am

Re: kml file

Postby vishakha » Wed Jun 29, 2011 11:32 am

Hi Rommy,
If you got that kml file from google api , then please can you share code for fetching that kml file from api ?
vishakha
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Oct 30, 2010 10:10 am

Re: kml file

Postby Rommy » Thu Jun 30, 2011 7:44 am

vishakha wrote:Hi Rommy,
If you got that kml file from google api , then please can you share code for fetching that kml file from api ?


I tried the alternative solution..
I send two coordinates (longitude and latitude) of two locations via Google API Directions and after that I have to parse it since the output is XML or JSON.

Then, you can use XML Parser or JSON Parser.
That's all I got...
Rommy
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Oct 19, 2010 10:21 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests