Tagged: customise, google maps, pan, zoom
-
AuthorPosts
-
July 28, 2015 at 7:40 pm #479881
Hi,
I have multiple worldwide locations on a Google map and would like to display the map so that it shows the full map of the world with all of the locations in view. I have played around with the different Zoom Levels and feel that I need something between 2 and 3. Is is possible to customise this somehow? Zoom level 2 repeats the map of the world and Zoom 3 doesn’t show all of the locations.
Can anyone help?
July 30, 2015 at 6:43 am #480534Hi lol4000,
I’ve never tried anything like that myself but maybe something like this could help? http://stackoverflow.com/questions/12458456/how-to-change-the-zoom-level-of-google-maps-programmatically
Cheers!
RikardJuly 30, 2015 at 12:11 pm #480639Yes that should work, can you tell me which file I can find the code for Google maps so that I can edit? Im not brilliant with Jquery but should hopefully be able to suss this out.
many thanks
July 30, 2015 at 6:46 pm #480839Hey!
Please go to Enfold/config-templatebuilder/avia-shortcodes and edit google_maps.php file
Best regards,
YigitJuly 30, 2015 at 9:48 pm #480969Thanks for that however, I thought the Google API was configured using Jquery? The code in the php file looks like its for the admin side of things.
July 30, 2015 at 11:43 pm #480997Hi!
You should be able to target the map through a header.php snippet and change the zoom from there.
Regards,
BasilisAugust 3, 2015 at 8:55 pm #482410OK, so I have added the below code to the header.php file:
<script> var mapOptions = { zoom: 8, }; map.setOptions(mapOptions); </script>
I get an error in the javascript console: Uncaught reference error: Google is not defined.
- This reply was modified 9 years, 3 months ago by lol4000.
August 4, 2015 at 5:17 pm #482840Hi!
I don’t think it’s the correct way of adding the script. Anyway, it will actually do the same thing as the Zoom Level settings if you manage to make it work. I tried to find the closest zoom level to show the whole world map on my installation and I found out that zoom level 3 and a Map height of 700px is the closest option.
Cheers!
IsmaelAugust 4, 2015 at 5:33 pm #482864The script has already been added hasn’t it? I simply want to overwrite the settings and what I have above should do that according to the documentation. I wanted to customise the Pan also which isn’t an option within the Enfold map settings.
August 5, 2015 at 4:00 pm #483435Hi!
Perhaps what your wanting to do is something like this, http://stackoverflow.com/questions/15719951/google-maps-api-v3-auto-center-map-with-multiple-markers. It’s kind of bordering on custom work though. I think your best bet is to play around with the zoom setting until they are all in view.
Regards,
ElliottAugust 5, 2015 at 4:08 pm #483448That would be great, however, I get an JS error message whenever I try adding custom code in the header.php file as suggested.
I have given up with this now, thanks anyway.
August 6, 2015 at 8:13 am #483712 -
AuthorPosts
- You must be logged in to reply to this topic.