Skip Navigation

[Gelöst] programaticaly use a link to set a map zoom level

This support ticket is created vor 2 Jahre, 10 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by stuart vor 2 Jahre, 10 Monate.

Assisted by: Waqar.

Author
Artikel
#2078259

using Maps in Toolset (specifically Google Maps) is there a way to have button or a link set a specific zoom level - .e.g zoom level 4.

What I would like to do is have a map view that allows the client to have 3 specific zoom levels they can use with the click of a button, rather than using the standard controls to zoom in - just one click and they are at the correct desired level.

They are going to be using this in presentations and will need it to be easy to zoom an focus - Zoom 1 (far out, all markers), Zoom 2 (Closer, view roads nearby etc), Zoom 3 (Max on the building, or land).

is it possible, I will assume it is as this posts eludes to something similar, but I wondered if you have any snippets that would help me implement such a thing:

https://toolset.com/forums/topic/changing-the-zoom-level-via-js/

🙂 thanks

#2078823

Waqar
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

map-options.png

Hi,

For what you're planning, Toolset map offers some built-in options.
( screenshot attached from the "Fields and Views" button )

With the default settings, when the map loads, it shows with maximum zoom-in level possible, while ensuring that all the available map markers are visible. This is what can serve as your zoom 1 option and you can add a "zoom-out" link which will always revert the map to this default state.

Example:


<a href="#" class="js-wpv-addon-maps-restore-map" data-map="map-1">Default Map</a>

Please replace "map-1" with your actual map's ID.

For zoom 2, you can use the "focus on marker" option, which will focus the map to the specific marker and its surroundings on the map:


<a href="#" class="js-wpv-addon-maps-focus-map" data-map="map-1" data-marker="marker-[wpv-post-id]">focus on marker</a>

Please replace "map-1" with your actual map's ID and "marker-[wpv-post-id]" with the actual format of the map marker IDs that you're using.

For the maximum closed in zoom 3, there is no built-in option but you can use the custom link for the street view that opens it in a new tab instead of the map on the same page, as discussed in the other ticket.
( ref: https://toolset.com/forums/topic/click-to-direct-streetview-of-location/ )

regards,
Waqar

#2080857

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.