Arrow (direction) on routes/lines

987 views
Skip to first unread message

svebee

unread,
Oct 30, 2010, 6:11:29 AM10/30/10
to Google Maps JavaScript API v3
I have few icons (from one city to another) and they are connected
with "route.push", "new google.maps.Polyline". And that works just
fine.

What I want is arrows on those lines - so if I have line from ICON1 to
ICON2 arrow on the middle of the line points to ICON2. If I have line
from ICON2 to ICON1 then arrow should be reversed.

Is it possible to draw an arrow on those lines, and of course,
depending on direction (which coordinates are loaded first, for ICON1
or ICON2) point an arrow towards correct icon?

geoco...@gmail.com

unread,
Oct 30, 2010, 9:22:48 AM10/30/10
to Google Maps JavaScript API v3
Yes. There have been a bunch of threads on doing that on the v2
group, some of them quite recent:
http://groups.google.com/group/google-maps-api/search?group=google-maps-api&q=arrow+on+polyline&qt_g=Search+this+group

-- Larry

svebee

unread,
Oct 31, 2010, 4:24:39 AM10/31/10
to Google Maps JavaScript API v3
But this is V3 :)

I have found my "solution" - it's in "Feature requests" for V3 :/

On Oct 30, 2:22 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Oct 30, 3:11 am, svebee <sven.kapud...@gmail.com> wrote:
>
> > I have few icons (from one city to another) and they are
> > connected with "route.push", "new google.maps.Polyline". And
> > that works just
> > fine.
>
> > What I want is arrows on those lines - so if I have line from
> > ICON1 to ICON2arrowon the middle of the line points to ICON2. If
> > I have line from ICON2 to ICON1 thenarrowshould be reversed.
>
> > Is it possible to draw anarrowon those lines, and of course,
> > depending on direction (which coordinates are loaded first, for
> > ICON1 or ICON2) point anarrowtowards correct icon?
>
> Yes.  There have been a bunch of threads on doing that on the v2
> group, some of them quite recent:http://groups.google.com/group/google-maps-api/search?group=google-ma...
>
>   -- Larry

Rossko

unread,
Oct 31, 2010, 4:50:24 AM10/31/10
to Google Maps JavaScript API v3
> But this is V3 :)

There doesn't seem to be any reason why you can't adapt the techniques
people use to create arrows in v2, and fit them for v3. v2 has no
special arrow features either ; people developed their own code.

geoco...@gmail.com

unread,
Oct 31, 2010, 8:42:27 AM10/31/10
to Google Maps JavaScript API v3
On Oct 31, 1:24 am, svebee <sven.kapud...@gmail.com> wrote:
> But this is V3 :)

v3 is close enough to v2 that the solutions uses are applicable, the
details may differ. I haven't seen an implementation for v3.

>
> I have found my "solution" - it's in "Feature requests" for V3 :/

If you need it in the near term, that may not be the best "solution".
And as v3 is supposed to be a "lightweight mobile" version of the
mapping API, I wouldn't expect it to be a high priority (but I am not
associated with google).

-- Larry

Pil

unread,
Oct 31, 2010, 11:35:14 AM10/31/10
to Google Maps JavaScript API v3


On Oct 31, 1:42 pm, "geocode...@gmail.com"
>  I haven't seen an implementation for v3.


When I look at Mikes example at

http://econym.org.uk/gmap/arrows.htm

I see two problems for v3:

The first one should be easy to solve. v3 has no method

getVertexCount() and no
getVertex(i)

for the polylines. But v3 has getPath() instead that should do the
same thing in this case.

The second problem is that v3 still misses the promised "library of
spherical geometry" as an extra module. [1]

So there are no methods

latRadians()
lngRadians()

for the bearing. This is a work that has to be done for oneself.


[1] This plan was made public here: http://groups.google.com/group/google-maps-api/msg/87ac28c52c1c1865

geoco...@gmail.com

unread,
Oct 31, 2010, 1:13:17 PM10/31/10
to Google Maps JavaScript API v3
On Oct 31, 8:35 am, Pil <wolf...@gmail.com> wrote:
> On Oct 31, 1:42 pm, "geocode...@gmail.com"
>
> >  I haven't seen an implementation for v3.
>
> When I look at Mikes example at
>
> http://econym.org.uk/gmap/arrows.htm
>
> I see two problems for v3:
>
> The first one should be easy to solve. v3 has no method
>
> getVertexCount() and no
> getVertex(i)
>
> for the polylines. But v3 has getPath() instead that should do the
> same thing in this case.
>
> The second problem is that v3 still misses the promised "library of
> spherical geometry" as an extra module. [1]
>
> So there are no methods
>
> latRadians()
> lngRadians()
>
> for the bearing. This is a work that has to be done for oneself.

There are lots of places to get solutions to both those problems, I'm
pretty sure they are both addressed by various examples I have done
(at http://www.geocodezip.com), they just aren't all together in one
place.

My understanding (I am not associated with google or part of the API
team) is v3 is being designed as a "light-weight mobile" version of
the mapping API (my translation), so it probably will never be as full-
featured as v2.

-- Larry
Reply all
Reply to author
Forward
0 new messages