Google maps API waypoint help

110 views
Skip to first unread message

ledzgio

unread,
May 7, 2009, 9:04:52 AM5/7/09
to Google API Libraries for GWT
Hi to all,

i'm using the GWT google maps API java wrapper and i have a question:

i have to draw a route starting from an array of waypoints, but i have
to represent on the map just the first and last waypoint while the
others middle waypoints should be highlighted with another image/icon
(different from classic waypoint A-B-C-...)..is it possible?

thanks a lot

Eric Ayers

unread,
May 7, 2009, 11:43:37 AM5/7/09
to gwt-goo...@googlegroups.com
You can retrieve the route without specifying a map.  In this case, you need to specify which parts of the route you want to return (in the DirectionQueryOption object passed to Directions.load9)) and re-create the route using the pieces returned to you in the DirectionsResults object in the way you want and add it to your map.   You can walk the steps in the route and add custom markers, for example.
--
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

ledzgio

unread,
May 7, 2009, 11:58:14 AM5/7/09
to Google API Libraries for GWT
Thanks Eric,

after i have retrieved the route as you said,
if i add custom markers in the steps i want
i lost the route (the route drawn in the map) and i have just the
markers in some points without routes!

How can i fix it?

On 7 Mag, 17:43, Eric Ayers <zun...@google.com> wrote:
> You can retrieve the route without specifying a map.  In this case, you need
> to specify which parts of the route you want to return (in the
> DirectionQueryOption object passed to Directions.load9)) and re-create the
> route using the pieces returned to you in the DirectionsResults object in
> the way you want and add it to your map.   You can walk the steps in the
> route and add custom markers, for example.
>

Eric Ayers

unread,
May 7, 2009, 1:06:15 PM5/7/09
to gwt-goo...@googlegroups.com
I think by the 'route'  you mean the polyline.  You can re-draw the polyline yourself based on the placemarks, or you can call setRetrievePolyline() on the DirectionsQueryOptions when you query, and retrieve the polyline from the DirectionsResult object and add it to the map. 

ledzgio

unread,
May 8, 2009, 10:59:44 AM5/8/09
to Google API Libraries for GWT
Ok now it works fine, thanks Eric.

unfortunately i still have a problem when i try to create a marker,
then i set an icon to it (through MarkerOptions) and add a
MarkerClickHandler.
If i try to mapWidget.getInfoWindow().open(event.getSender(), new
InfoWindowContent("test")); i can't show info window, on the contrary
if i remove the icon it works good.

Where is the problem? thanks again

ledzgio

unread,
May 8, 2009, 11:13:14 AM5/8/09
to Google API Libraries for GWT
I've fixed the problem by myself: i had to setInfoWindowAnchor(Point)
for each Icon object to add to the MarkerOptions object.

bye
Reply all
Reply to author
Forward
0 new messages