Google Driving Directions - MapView overlayed

Tutorials that use the MapActivity. Many using GPS functionality.

Postby SamB09 » Mon Feb 22, 2010 1:51 pm

Hi those classes are no longer available to use.
SamB09
Developer
Developer
 
Posts: 39
Joined: Tue Oct 27, 2009 9:22 pm
Location: England

Top

Postby phaniraghav » Tue Feb 23, 2010 6:23 am

do i have any other alternative to get the directions on Google Maps.
phaniraghav
Freshman
Freshman
 
Posts: 5
Joined: Mon Feb 22, 2010 12:09 pm

Postby mathias.lin » Fri Feb 26, 2010 6:42 am

You can make http requests to maps.google.com/maps, and work with the raw kml/xml data.
Earlier in this thread, this URL was already mentioned:
http://csie-tw.blogspot.com/2009/06/and ... -path.html
Please take a look.
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Postby Profete162 » Fri Mar 19, 2010 12:32 pm

Hi there.

Thank all for all these informations and successfully added a "directions" menu in my application. ( Mathias link is usefull)

I feel stupid to ask that, but how is that possible to remove an overlay from the map??
Because if i need to compute 2 or 3 directions, the old one still shows on the map!

This is really annoying. Thank a lot.


Profete162
Profete162
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Nov 27, 2009 6:07 pm

Postby mathias.lin » Fri Mar 19, 2010 1:00 pm

Remove an overlay like this: mapView.getOverlays().remove(object/int)
Of course you need to keep a reference or the index of the overlay when adding it, so you can later remove it again.

BTW: for parsing the KML data, did you use the same class as in the example I gave the URL to? For some reasons, which I can't recall at the moment, it didn't work well for me and I ended up using the javax.xml.parsers.SAXParser

Profete162 wrote:Hi there.

I feel stupid to ask that, but how is that possible to remove an overlay from the map??
Because if i need to compute 2 or 3 directions, the old one still shows on the map!

Profete162
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Postby Profete162 » Fri Mar 19, 2010 1:08 pm

Hi Mathias,

The solution you gave mapView.getOverlays().remove(object/int) was what i was working with. It worked perfectly with the index. But as the index has to be calculated is there a simple way to say this: ?

"remove if mMapView01.getOverlays().get(pos).getClass()== blabla.blabla.MyOverLay" or something like that?




For your question, i just copied the code given on your link and all worked perfectly at the first try. I feel really happy with this code but i only tried it for a few minuts and worked 100%

Thanks
Profete162
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Nov 27, 2009 6:07 pm

Top

Postby mathias.lin » Fri Mar 19, 2010 1:14 pm

You could manage overlays/pos with a hash map when you edit them and then retrieve the pos (or better the overlay object) from the hash map when you want to delete it.
I think working with the object rather than the pos might be easier though (since the pos changes once you delete an overlay).
But generally a hash map would be the easiest way to manage it I think.

Profete162 wrote:Hi Mathias,

The solution you gave mapView.getOverlays().remove(object/int) was what i was working with. It worked perfectly with the index. But as the index has to be calculated is there a simple way to say this: ?

"remove if mMapView01.getOverlays().get(pos).getClass()== blabla.blabla.MyOverLay" or something like that?




For your question, i just copied the code given on your link and all worked perfectly at the first try. I feel really happy with this code but i only tried it for a few minuts and worked 100%

Thanks
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Re: Google Driving Directions - MapView overlayed

Postby Rajeshnaidu » Fri May 21, 2010 1:01 pm

Can u help how add com.google.googlenav.drivingdirections.

i added android sdk version 0.9.But there is no use at all.I cant able to find DrivingDirections calss.I m using Eclispe 3.4 version.

Thanks in advance.
Rajeshnaidu
Once Poster
Once Poster
 
Posts: 1
Joined: Fri May 21, 2010 12:55 pm

Re: Google Driving Directions - MapView overlayed

Postby mathias.lin » Fri May 21, 2010 1:24 pm

I don't use googlenav or sdk0.9, so I cannot really help you here, sorry. But you should search this forum for 'AndNav' and should find some discussion about navigation. There are lots of threads about it this forum.
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Re:

Postby mirathis » Mon Jun 21, 2010 2:23 am

plusminus wrote::arrow: http://href.to/jNe


Is this where you "the DrivingDirections via an URL-Call and parses the JSON response?"

I followed your above link, but could not find the tutorial. What is the name of the post?

Thanks
mirathis
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 21, 2010 1:48 am

Re:

Postby mirathis » Mon Jun 21, 2010 2:32 am

plusminus wrote:I have posted another tutorial that gets the DrivingDirections via an URL-Call and parses the JSON response.

Best Regards,
plusminus



Hi PlusMinus,

I have a question about the deprecated "DrivingDirections" access to Google API and your URL-Call solution.
First, I can't find the tutorial you indicated below anywhere (would like to).

Second, If you parse the JSON request (I assume you then get directions or something), how do you draw each route segment, from street to street, on the map?

Thanks in Advanced,
MT
mirathis
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 21, 2010 1:48 am

Re: Re:

Postby mathias.lin » Mon Jun 21, 2010 2:37 am

mirathis wrote:
plusminus wrote::arrow: http://href.to/jNe


Is this where you "the DrivingDirections via an URL-Call and parses the JSON response?"

I followed your above link, but could not find the tutorial. What is the name of the post?

Thanks


The API for driving directions isn't available for SDKs > 0.9
Therefore I think the tutorial link is very old and outdated meanwhile; thus the intro post of this thread meanwhile says 'outdated'.

If you're developing for the common SDKs versions, you cannot get the directions as JSON response. You need to call the maps web api and you will get an XML response that you can parse.
See the link in one of my earlier posts in this thread.
http://csie-tw.blogspot.com/2009/06/and ... -path.html
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Re: Google Driving Directions - MapView overlayed

Postby mathias.lin » Mon Jun 21, 2010 2:41 am

Hm, or maybe json is available alternatively to xml... check stackoverflow for this parsing example, but also via http web api only as well:

http://stackoverflow.com/questions/2951 ... directions
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Re: Google Driving Directions - MapView overlayed

Postby sumit_android » Thu Jul 08, 2010 12:33 pm

hellooooo plus minus.....
i am also wanna one thing...plz provide us any valid and proper solution for drawing route on map view for the sdk version higher 1.1
your some api in above code not resolve properly.
I hope you will give me any helpful solution very quickely....
thnx...
sumit_android
Junior Developer
Junior Developer
 
Posts: 19
Joined: Fri Feb 19, 2010 6:59 am
Location: India

Re: Google Driving Directions - MapView overlayed

Postby mathias.lin » Thu Jul 08, 2010 2:12 pm

> your some api in above code not resolve properly.

That's why I'm not suggesting to look into these projects at all. They're outdated.

You can take a look at

1) http://stackoverflow.com/questions/3109 ... 23#3109723

You can also look for a sample at

2)
http://www.google.com/codesearch/p?hl=e ... uteandroid\.googlecode\.com&sa=N&cd=1&ct=rc

and in here, look for the 'drawRoute' method, which then makes use of the class:

http://www.google.com/codesearch/p?hl=e ... uteandroid\.googlecode\.com&sa=N&cd=1&ct=rc
User avatar
mathias.lin
Experienced Developer
Experienced Developer
 
Posts: 60
Joined: Tue Aug 11, 2009 4:21 am
Location: Guangzhou, China

Top
PreviousNext

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests