Update: it works!
It was the preserveViewport thing. I don't know what I did wrong the
first time.
Thanks alot!
That leaves me with 1 problem: I have a link "show all mini
maps" (shows the mini map to each step).
This link calls a function that loops as many times as there are steps
for the route. On every loop it calls my "show_mini_map" function.
I don't know if this is going to fast for the API, because all the
maps end up with a grey screen saying "zoom leven to high for this
area" (it's not, definitely)
and the marker I usually set is wrong too. If I load them seperately
they all work (showing single steps and showing all steps use the same
function,
so it's not a code-problem I think).
Does anyone know something about this issue?
Oh and one more question, is there a way to tell
mini_map.setCenter(new GLatLng(lat,lon),zoom_level); to use the
highest available
zoom for that area? That would be great.
Thanks for your help.
On 2 Sep., 09:54, crispy <[EMAIL PROTECTED]> wrote:
> Esa - sorry about that, the php bit bascially fills in the "from" and
> "to".
>
> Rossko - the panTo() does fail :( I tried that already.
> Am I using the {preserveViewpoint:true} correctly like this:
>
> sdir.load("from: a to: b", {'preserveViewpoint': 'true'});
>
> You understood correctly. I just want to show a little map, with just
> that step of the route on it.
> But each mini_map should also have the direction on them, of course
> there will only be a little part of the directions visibile.
>
> Yes, the "from" and "to" are coming out of a DB, the user already
> confirmed elsewhere where he wants to go.
> So I fill in the from and to, then I show a big map (which works),
> then I parse an XML file containing the information for each step
> and show a list of directions (I have to do this with XML because JS
> won't work everywhere), then I want to show a mini map
> for each step, called by the function above "show_mini_map". That's
> what I want to / have to do.
> Basically, it's just like the google print page for driving directions
> (link posted in first post). But I can't get those mini maps to focus
> to the current step.
>
> I hope you know what I mean now, sorry for being unclear.
>
> Thanks.
>
> On 2 Sep., 00:55, Rossko <[EMAIL PROTECTED]> wrote:
>
> > > and it still fits the whole route..?
>
> > Compare and contrast -
> > mini_map.setCenter(new GLatLng(lat_lon));
> > ....
> > mini_map.panTo(lat_lon);
> > I think the panTo() will fail.
> > But in fact you don't need it all if you get the
> > {preserveViewpoint:true} as already advised; the panTo() would just
> > set the same centre as the setCenter() already has.
>
> > Neither of those affect the zoom at all. However I'm not all sure you
> > really want to {preserveViewpoint:true}, don't you want to show just
> > the one step?
>
> > If I understand you right, you are using this function show_mini_map()
> > to show just one step from a set of directions.
> > I can see you are using PHP to fill-in the 'from:' and 'to:'
> > parameters inside the function.
> > You do understand that PHP fills those in before even the page is sent
> > to the user's browser, and no matter what the user clicks on it won't
> > affect the values in the function?
>
> > What I don't understand is why, when you have all the steps already
> > for the 'big' directions, you are trying to get directions for each
> > step all over again!
>
> > cheers, Ross K
>
> > mini_map.panTo(lat_lon);
> > isn't going to change the zoom level.
> > Do you really mean 'zoom', or do
>
> > > On 1 Sep., 17:39, Mike Williams <[EMAIL PROTECTED]> wrote:
>
> > > > GDirections.load() is asynchronous, and, unless you specify
> > > > {preserveViewpoint:true} it centres and zooms the map to fit the entire
> > > > route when the reply comes back from the server.
>
> > > > Your panTo occurs immediately after the GDirections request is sent, so
> > > > it gets countermanded when the GDirections reply comes back.
>
> > > > --http://econym.googlepages.com/index.htm
> > > > The Blackpool Community Church Javascript Team- Hide quoted text -
>
> > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---