Fix centre and zoom level of map

New home Forums Basic Version Troubleshooting Fix centre and zoom level of map

This topic contains 3 replies, has 2 voices, and was last updated by  [email protected] 6 days, 15 hours ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #52083

    RoyH
    Member

    Hi there,

    I understand from working with the plugin, and reading the support forum, that you set the centre and zoom level of the map every time you save it.

    Is there a way that I can set the centre and zoom level of the map so that it does not change? So that every time I open the map it is centred and zoomed to fit the area I want to cover on the screen?

    I would like to be able to move pins around and scroll around the map, but when I save it, the centre and zoom stays as originally defined

    I have attached a screenshot, the only area I am interested in is inside the blue boundary.

    Many thanks,

    RoyH

    Attachments:
    You must be logged in to view attached files.
    #52087

    Hi there,

    Thanks for getting in touch.

    Yes, this can be achieved by going to Maps > Settings and disabling the zoom and scrolling controls and features for the map. This will mean that in the frontend, the users will not be able to move or zoom the map in or out.

    Please do let me know if this helps.

    Thank you.

    Kind regards,
    Dylan

    #52088

    RoyH
    Member

    Thanks for your prompt response, Dylan. I did have a look at that setting, but it doesn’t really do what I want.

    I do want front-end users to be able to move and zoom around the map, but the initial view we want to present is always going to be the same, but every time I edit a portion of the map, it changes the centre point and zoom settings, and I am finding it difficult trying to line up the back-end map accurately every time before I save it.

    Is there a way I can make the centre point and zoom level effectively ‘read only’ and not change when the rest of the map is edited?

    Thanks again,

    RoyH

    #52099

    Hi there,

    Thanks for the response and sorry for the delay over the weekend and for the misunderstanding on my side.

    This is not possible out of the box, however, this can be achieved with some custom JS. To add Custom JS to the dashboard, you can install the Simple CSS and JS plugin which lets you add custom JavaScript and set whether to load it in the backend or frontend.

    The code to add is:

    jQuery(window).load(function(){
    var map = WPGMZA.maps[0];
    if (typeof map !== 'undefined') {
    var latLng = new google.maps.LatLng(26, 28);
    map.panTo(latLng);
    map.setZoom(4);
    }
    });

    You can set your custom coordinates and zoom as the above zoom and lat and long are just examples.

    Alternatively, you can add this JS to the frontend by going to Maps > Settings > Advanced > Custom JS and then it will pan/zoom to this location when the map loads, so then it will not matter where the map position is saved as it will always start on your location set in the JS code above.

    I hope this helps and please do let me know if you are able to add it correctly.

    Thank you.

    Best regards,
    Dylan

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.