Multiple Maps on One Page

7,741 views
Skip to first unread message

mrhenniger

unread,
Jul 16, 2011, 12:18:35 PM7/16/11
to Google Maps JavaScript API v3
I am not a Google Maps expert. I figured out how to do the V2 version
a few years ago. About six months ago I started to convert my pages
to the V3 API with success. I do like the new API.

However, I am now just starting to convert my pages which have more
than one map per page. I have a prototype page for this...
http://www.aerialvisuals.ca/LocatorTravelPlanner_Review_Experiment.php?Serial=55
...but as you can see nothing shows for the maps. If I remove all
code related to the second map I can see the first map with multiple
markers and polylines with no issue. As soon as I add in the code for
the second map neither of the maps display.

This may be a syntax thing, or perhaps I am breaking an API rule that
I am not aware of. Could someone here with more experience in these
things take a look at the page source?

Thanks in advance for any tips anyone can provide.

Mike


Shreerang Patwardhan

unread,
Jul 16, 2011, 12:22:57 PM7/16/11
to google-map...@googlegroups.com
Hi Mike,

You will find two examples on my Google Maps API blog "Spatial Unlimited"...One with 2 maps on the same page and then the other with 4 maps!

http://shreerangpatwardhan.blogspot.com/2011/06/two-maps-on-same-page-side-by-side.html

http://shreerangpatwardhan.blogspot.com/2011/07/four-maps-on-same-page-playing-with.html

Hope these 2 examples help!

Regards,
Shreerang.



--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Rossko

unread,
Jul 16, 2011, 2:39:07 PM7/16/11
to Google Maps JavaScript API v3
> This may be a syntax thing,

Firebug tells me there is a missing closing curly bracket. I don't
know exactly where, it's difficult to spot the way your code is laid
out. Using indents may make it easier for you to find.

More seriously, you have two functions called initializeMap() ;
definitely not allowed (how would a browser know which one to run?)

mrhenniger

unread,
Jul 19, 2011, 8:55:02 PM7/19/11
to Google Maps JavaScript API v3
You guys have been fantastic! The examples were just what I needed to
help me to recognize what I was doing wrong. I was able to see I
wasn't managing the initializations correctly.

As for the formating... Yeah you are correct. That java script you
are referring to is generated by PHP. I should insert some \t's here
and there. Adding it to the list.

Mike
Reply all
Reply to author
Forward
0 new messages