I am trying to: display a map based on an address field in a custom post
Link to a page where the issue can be seen: hidden link
I expected to see: a reasonable size map centered on the address of the member
Instead, I got: a map centered in the Atlantic Ocean west of Africa
Here's the code to generate the map. It's in a text module, in a Divi content template for the member post type. Same symptoms in a code module.
{!{wpv-map-render map_id="map-3" fitbounds="off" single_zoom="10" single_center="off"}!}{!{/wpv-map-render}!}{!{wpv-map-marker map_id='map-3' marker_id='marker-3' marker_field='wpcf-address-for-map'}!}{!{/wpv-map-marker}!}
The attribute single_center="off" cuts off the centering.
I am right that you use the Maps setting "Maps Zoom and Center > Set zoom center and center manually > Force the map center setting even with just one marker", right?
That is the setting that produces fitbounds="off" single_center="off" together.
Then, you should use Coordinates for the map center settings, as you will otherwise have 0,0 as centered location, and the map will not center on a marker.
I think, you should remove those, if you want the map to center on the single marker
I mean, even if there is a marker, we set here that the map should load always, and especially if there is just one marker, on a specific spot.
That cannot zoom in on a marker at any level, which you try to do in the shortcode with single_zoom="10"
Would you agree that the GUI (graphical user interface) actually should not allow to insert those attributes together?
That is where the confusion sources from - it is not supposed to be done, I think.
Okay, that gets it to center but I can't figure out how to set the zoom. I tried general_zoom and single_zoom. It's coming up zoomed way in and I need to back it out a bit.
Hi, this code should cause the map to be zoomed out a bit when only one marker is present:
{!{wpv-map-render map_id="map-3" single_zoom="10"}!}{!{/wpv-map-render}!}{!{wpv-map-marker map_id='map-3' marker_id='marker-3' marker_field='wpcf-address-for-map'}!}{!{/wpv-map-marker}!}
If that's not working for you, I'll need to take a closer look. Please provide login credentials in the private fields here and I will see what's happening.
Although your fix corrected it on most members, for some reason this one is still broken:
hidden link
Okay I logged into the site and deleted this address in the Member's post editor screen. Then I cleared the address from the Maps cache in Toolset > Settings > Maps, and added the address again in the Member's post editor screen. It's showing up at the correct zoom level now, I believe. Must have been a cache problem.
I tried to take a look at the Content Template created with Divi for the Directory page View, but I'm getting a database connection problem. Since this is a different View and map than the original map centering problem, may I kindly ask you to create a new ticket? This helps us keep the forum organized and helps other users find answers to similar questions. Thanks!
Thanks not only for fixing it but also for telling me how, in case I run up against a similar problem in the future.