Detect, is mark in window?

20 views
Skip to first unread message

peter mlich

unread,
Jul 13, 2011, 7:13:21 AM7/13/11
to google-map...@googlegroups.com
Hi. How can i detect, if mark (lat-log) is in my window map?
I can, if mark in in window, its select. If mark is not in window, i can find it by DirectionsService and select.

Demo:
http://axpsu.fpf.slu.cz/~web/gmapa-demo/js-gmapa.htm
Now do route all marks.
start = M mark, dragable movable
end = other mark, static
Click on mark "E" (Na Rybníčku 626/1), mark is in window, do only select by purple color (now do route)
Click on mark "I" (Vávrovická 244/44), mark is not in window, i must find it, show in window and select it by by purple color
If i can stop route effect for mark E i must detect, if mark in window. How can i do it?

Rossko

unread,
Jul 13, 2011, 8:28:07 AM7/13/11
to Google Maps JavaScript API v3
> Hi. How can i detect, if mark (lat-log) is in my window map?

Get the bounds of the visible map. See if the location of your 'mark'
is contained within those bounds.

peter mlich

unread,
Jul 13, 2011, 9:38:52 AM7/13/11
to google-map...@googlegroups.com
Browser window is square. []]]
But real map with lat-log is squared bubble. (]])
Is the api function that detects, what lat-log is in? Or function, detect mark pixel position?

peter mlich

unread,
Jul 14, 2011, 3:34:04 AM7/14/11
to google-map...@googlegroups.com
I found it. Thanks.
    if (!MAP.getBounds().contains(new google.maps.LatLng(m.gps2[0],m.gps2[1])))
        {
        calcRoute(m.gps2);
        }

Reply all
Reply to author
Forward
0 new messages