Skip Navigation

[Gelöst] Map Zoom not working on single location

This support ticket is created vor 5 Jahren, 10 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 9 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von jasonH-5 vor 5 Jahren, 10 Monaten.

Assistiert von: Waqar.

Author
Artikel
#1192490

Hello,

I have a map view showing on an author.php page where I have used this for business location landing pages. I have the map working showing the proper location but no matter what I do I cannot get the map to zoom out by default. Here is my views set-up:

<!-- wpv-loop-start -->
[wpv-map-render map_id="map-4" map_height="400" single_zoom="5"][/wpv-map-render]
		<wpv-loop>
         [wpv-map-marker map_id='map-4' marker_id='marker-5' single_zoom="5" marker_usermeta='wpcf-address' id='[get_user_id]'][/wpv-map-marker]
		</wpv-loop>

I am displaying the view using php in author.php

#1192580

Hi Jason,

Thank you for contacting us and I'll be happy to assist.

I tried to view your website, but it was behind a folder level access protection.

As a general note, the map controls the zoom level and the center automatically when the "fitbounds" attribute is not set or set to "on":
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-render

To make sure that your assigned "single_zoom" attribute value is used instead, please include fitbounds="off" in the map's shortcode:


[wpv-map-render map_id="map-4" map_height="400" single_zoom="5" fitbounds="off"][/wpv-map-render]

Note: if you'll check the arguments for the shortcode "wpv-map-marker", you'll note that it doesn't accept the "single_zoom" attribute and you can remove that from your marker's shortcode too.
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-marker

I hope this helps!

regards,
Waqar

#1192604

So I added the fitbounds="off" but now the map centers over Africa. The Marker is seen once you zoom way out. I also changed the zoom level from 5 to 10 and nothing happened.

The site uses a username password at first. Sorry I did not provide this. Let me know best way to provide this.

Thank you!

#1192870

Hi Jason,

Thanks for writing back.

I apologize for missing out this detail earlier since it is available in the shortcode's documentation:
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-render

Setting the "fitbounds" to "off" is like telling the map that you'd like to control the zoom level and centering, manually. For this reason, you'll also need to specify:

- "general_zoom" attribute (default zoom for the map when it loads)
- "general_center_lat" attribute to tell the latitude to use for the map's center
- "general_center_lon" attribute to tell the longitude to use for the map's center

This should do the trick, but I'm still setting your next reply as private, in case you need to share the access details for further troubleshooting.

regards,
Waqar

#1193945

So I am still confused as how do I specify the Lon / Lat in the manual settings?

Here is login to main site, I provide wp-admin before

{removed}

#1194112

Hi Jason,

The username and password for the front-end access worked, but the ones for the admin area didn't.

You can use Google Maps ( versteckter Link ) or the "latlong.net" tool ( versteckter Link ) to get the "Latitude" and "Longitude" of your desired location.

For example, suppose you want to set the map's default manual center to "Empire State Building".

You'll open its marker in the Google Maps and copy the "Latitude" and "Longitude" ("40.748570" and "-73.985614", respectively).
( screenshot: versteckter Link )

In the shortcode, you can use these values after rounding them to 4 decimal places, for example:


[wpv-map-render map_id="map-4" map_height="400" general_zoom="10" fitbounds="off" general_center_lat="40.7485" general_center_lon="-73.9856"][/wpv-map-render]

regards,
Waqar

#1194177

So my addresses are not manually entered. These are profile accounts where the user inputs address to then display a single marker on the map. I cannot manually enter each on as there will be hundreds of these.

The login will work now. I had overwritten the DB. Sorry about that.

I looked into how to pull the coordinates and plugin them into the fields but did not find anything online or in the support forum. The coordinates display in the backend but I do not see a shortcode to display them.

Thanks for your help.

#1194452

Hi Jason,

Thank you for enabling the admin area access.

I apologize, as I thought you were working with a map with multiple markers and not a single one.

Looking at the view "Single Map" ( versteckter Link ), I noticed that it is currently set to cycle through all available users with role "Location", which is resulting in multiple entries for the marker code ("34" times, which is equal to the number of users with "Location" role).

Since this view needs to show only information about a single user whose author archive page is showing, it should only be cycling/processing a single user.

This will require adding a "Query Filter" that should only bring in user whose ID is set by a shortcode attribute "users". I've already set this for you, as shown in this screenshot:
versteckter Link

To make sure the ID of the user whose author archive page is being viewed gets passed on to the view's shortcode in the "author.php" file, you'll need to update the code from:


<?php $args = array(
	'title' => 'Single Map',
	'myattribute' => 'single-map'
	);
echo render_view( $args );
?>

To:


<?php 

$req_user_ID = do_shortcode( '[get_user_id]' );

$args = array(
	'title' => 'Single Map',
	'users' => $req_user_ID
	);
echo render_view( $args );
?>

Once the view is fixed, the marker code will only exist for one user and the zoom level attribute should work.

I hope this helps and please let me know how it goes.

regards,
Waqar

#1197830

Thank you for your help. So I changed the post type from users to a post. How would I incorporate this now? I tried using the post ID but it is not working.

Thank you for your help.

#1197845

I ended up just creating a content template and adding the map that way. Thank you!