Skip Navigation

[Resolved] Add margin to fitbounds of map or set single_center to Poland

This support ticket is created 2 years, 9 months ago. 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.

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 4 replies, has 2 voices.

Last updated by Waqar 2 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2347105

Tell us what you are trying to do?

Hello, I've created and rendered map correctly but I'm struggling with displaying it in the way I want. Please visit website, map is on front page. As you can see I have some shape dividers on this section and markers are clipped. Is there a chance to add some sotr of "margin" to fitbounds? If not how can I edit my shortcode to get map always centered on Poland? I think I should use single_center but not sure how.

My map shortcode:
[wpv-map-render map_id="map-1" map_width="100vw" map_height="70vh" fitbounds="on" general_zoom="7" single_zoom="10" cluster="on" map_type="terrain" street_view_control="on" map_type_control="off" background_color="#1a1a1a"]

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

hidden link

#2348443

Hi,

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

By default, Toolset Map automatically controls the map zoom level and the center, based on the available map markers, so that they can all fit and show nicely.

To set a fixed zoom level and the center, you'll need to set the "fitbounds" attribute to 'off' and specify the target center's location using the "general_center_lat" and "general_center_lon" attributes:
( ref: https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render )


[wpv-map-render map_id="map-1" map_width="100vw" map_height="70vh" fitbounds="off" general_zoom="5" single_zoom="10" cluster="on" map_type="terrain" street_view_control="on" map_type_control="off" background_color="#1a1a1a" general_center_lat="51.919438" general_center_lon="19.145136"][/wpv-map-render]

The above shortcode will show the map centered on Poland, irrespective of the available map markers.

regards,
Waqar

#2349121

Thanks for your reply. It's working as it should. I've got one more question tho.

My custom markers using SVG images. Is there a chance to set it's height and width? I know it's working with PNG images (it just shows entire image) but I'd rather to use SVG. Adding css div and class to [wpv-map-marker] and setting width and height doesn't seem to work. Bellow my marker shortcode:

[wpv-conditional if="(has_term('roboty-ziemne', 'rodzaj-realizacji', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_icon="hidden link" marker_id='marker-1-[wpv-post-id]' marker_field="wpcf-adres"]

[types field='glowne-zdjecie' title='%%TITLE%%' alt='%%ALT%%' size='medium' resize='proportional' class='custom-map-img'][/types]

<div class="cusom-map-organiser">
<div class="cusom-map-title">[types field='nazwa'][/types]</div>
<div class="cusom-map-adress">[types field='addres'][/types]</div>
<div class="cusom-map-description">[types field='opis' output='raw'][/types]</div>
</div>

[/wpv-map-marker]
[/wpv-conditional]

#2349127

Thanks for your reply. It's working as it should. I've got one more question tho.

My custom markers using SVG images. Is there a chance to set it's height and width? I know it's working with PNG images (it just shows entire image) but I'd rather to use SVG. Adding css div and class to [wpv-map-marker] and setting width and height doesn't seem to work. Setting SVG width and height within SVG itself also not working for me.

Bellow my marker shortcode:

[wpv-conditional if="(has_term('roboty-ziemne', 'rodzaj-realizacji', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_icon="hidden link" marker_id='marker-1-[wpv-post-id]' marker_field="wpcf-adres"]

[types field='glowne-zdjecie' title='%%TITLE%%' alt='%%ALT%%' size='medium' resize='proportional' class='custom-map-img'][/types]

<div class="cusom-map-organiser">
<div class="cusom-map-title">[types field='nazwa'][/types]</div>
<div class="cusom-map-adress">[types field='addres'][/types]</div>
<div class="cusom-map-description">[types field='opis' output='raw'][/types]</div>
</div>

[/wpv-map-marker]
[/wpv-conditional]

#2349411

Thanks for writing back.

I've performed some tests on my website, but couldn't adjust the size of the SVG image map marker icon. So, I'm afraid, for now, you'll have to use a non-SVG image type if you'd like to have more control over the map marker icon size.

You're welcome to submit a feature request at:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/