I have discovered an issue which causes a point from the directions
result to be off the map.
Just to clarify, I don't have preserveViewport set to true.
With almost all addresses the map re-zooms correctly to fit in both
Point A and Point B along with the polyline.
I have put together a simplified demo of the issue I am witnessing in
my application here:
http://taledo.com.au/demos/directions.htm
Upon visiting, please hit "find" and you will see that Point B is off
the map.
Any ideas/insights would be greatly appreciated
You are bringing up a similar issue as Erich in point 1 of
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/f6ae522cac602e7c
Chad Killingsworth
So seeing as the link you provided has no response either, is one to
assume there is no work-around for this issue?
Thx
On Jan 29, 12:10 am, Chad Killingsworth
<chadkillingswo...@missouristate.edu> wrote:
> Actually technically Point B is on the map - barely. Point B's marker
> on the other hand ...
>
> You are bringing up a similar issue as Erich in point 1 ofhttp://groups.google.com/group/google-maps-js-api-v3/browse_thread/th...
On Jan 29, 1:31 am, pete <petejun...@gmail.com> wrote:
> So seeing as the link you provided has no response either, is one to
> assume there is no work-around for this issue?
>
map.panBy(0,-20); // or:
map.setZoom(map.getZoom()-1);
But. First you should test if a marker is too close to map border. See
Pamela's technique in custom info window script.
http://gmaps-samples-v3.googlecode.com/svn/trunk/infowindow_custom/infowindow-custom.html
You need degrees/pixel ratios. She calculates those:
map.getBounds().toSpan().lat() / map.getDiv().offsetHeight;
map.getBounds().toSpan().lng() / map.getDiv().offsetWidth;
Now you can do some more calculation to get how close the marker is to
the border.
Second problem is how to perform zoomOut or panning. The asynchronous
nature of fitBounds() makes that your operation is presumably
overriden by DirectionsRenderer.
The brand new addListenerOnce() offers a solution with 'idle' event.
It is triggered only once.
Try putting inside the callback function of route(). (Just after
directionsDisplay.setDirections(response);) Even without any border
testing:
google.maps.event.addListenerOnce(map, 'idle', function(){
map.panBy(0,-20);
});
Any insight into this?
On Jan 29, 9:17 pm, Esa <esa.ilm...@gmail.com> wrote:
> On Jan 29, 1:31 am, pete <petejun...@gmail.com> wrote:
>
> > So seeing as the link you provided has no response either, is one to
> > assume there is no work-around for this issue?
>
> map.panBy(0,-20); // or:
> map.setZoom(map.getZoom()-1);
>
> But. First you should test if a marker is too close to map border. See
> Pamela's technique in custom info window script.http://gmaps-samples-v3.googlecode.com/svn/trunk/infowindow_custom/in...