Map centering not working in 2.73.16

Home Forums MapPress Support Map centering not working in 2.73.16

Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #19419

    I’m using MapPress to render a map using PHP, and centering the map over the UK using the Zoom and Center attributes.

    This was working OK using version 2.73.12 but the values specified for centering the map no longer seem to be applied in 2.73.15 and 2.73.16. Rolling my plugin version back to 2.73.12 has resolved the issue for me.



    Thanks for reporting this!   Can you please give me the shortcode, or an example?  A URL for the map would also be helpful.



    Sure – here’s the production URL (rolled back to 2.73.12 so the map works OK):

    And on a test server (running 2.73.16), where map should be centred on UK lat/lng but isn’t:



    How are you generating the map?  Are you using the Gutenberg post editor?

    If not, could you please past the shortcode (or other code) here?


    In a custom page template:

    $mymap = new Mappress_Map([
    "width" => "100%",
    "height" => "700",
    "center" => ["lat" => 54.5,"lng" => -4.5],
    "zoom" => 6,
    "poiList" => false,

    various loops to add POIs to an array ($loc_array is a geocoded array of lat/lng per POI):

    $mypoi_tmp = new Mappress_Poi(array(
    "title" => esc_attr(get_the_title()),
    "body" => "<p class='meta'>".esc_attr(wp_trim_words(get_the_excerpt(),30))."</p><p>More details</p>",
    "point" => $loc_array,
    $mypois[] = $mypoi_tmp;

    then rendered using:

    $mymap->pois = $mypois;
    echo $mymap->display(array("directions"=>"none"));

    I wondered if there might be a problem with a POI (as I have hundreds) causing some kind of hidden JS error but even rendering the map with no POIs, setting center/zoom is still ignored.



    What happens if you write the center like this?

    "center" => "54.5,-4.5"

    This was changed at some point – the plugin will process the center this way, rather than as a lat/lng array.

    Also, please use version 2.73.17 or higher – there was a bug in 2.73.16 where some lat,lng entries weren’t handled properly.


    Thanks – changing the format of the center value didn’t seem to fix it in 2.73.16 but upgrading to 2.73.17 does seem to have solved it.

    Could you update the documentation here at some point to help others, as this still shows center values being set using a lat/lng array?

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.