Support » Plugin: Business Directory Plugin | GeoDirectory » Zoom in on the map at the time of geocoding the address

  • Resolved EugeneUK

    (@euguk007)


    Hi.
    I wonder if there is a way to change the map zoom level (increase to 16) at the time when the new listing is being created and
    function geodir_codeAddress(set_on_map);
    is being executed.
    Thanks in advance!

Viewing 13 replies - 1 through 13 (of 13 total)
  • EugeneUK

    (@euguk007)

    Also, it would be great if the scrollwheel zoom could be disabled on that map in add listing form.

    Plugin Support alexrollin

    (@alexrollin)

    Hello, the developers are checking into it.

    In the meantime, please post your topic to our forum where we provide support:

    https://wordpress.org/support/topic/read-this-before-posting-for-support-free-premium/

    Plugin Author Stiofan

    (@stiofansisland)

    Hi @euguk007,

    Is the reason for the map zoom just so that it’s at that level on the single details page maps output? If not please elaborate on the reasoning?

    Thanks,

    Stiofan

    Exactly. So the map is zoomed in at the location level for the user to make sure it’s in the right position.
    Thank you, Stiofan!

    I think that 16 would be the right zoom…

    Plugin Author Stiofan

    (@stiofansisland)

    OK i just want to make sure we are talking about the same thing, i am not referring to the actual zoom level on the add listing map but instead, the zoom level of the map on the completed single details page?

    If that is what you want then you can set the level manually yourself:
    (Warning, once you unset using the user zoom level all user-set zoom level values are lost)

    1. Places > Settings > Custom Fields > Address > (show advanced) untick, “use user zoom level”.
    2. Then when you create a map in the details sidebar or in the page template it will use the value set as the zoom level in the shortcode/block/widget.

    Let me know if this is not what you mean 🙂

    Stiofan

    Not quite.
    I mean at the point when the listing is being added by the user. Add Listing form.
    When the user types in the street address and presses Set on Map, the marker moves on the location, but the zoom level stays the same. So user has to zoom in to check the position of the marker.
    This is for the back-end.

    The function I was referring to is in the:
    /geodirectory/templates/map.php
    on line 532:
    function geodir_codeAddress(set_on_map) { ...

    Plugin Author Stiofan

    (@stiofansisland)

    AH ok. No we don’t currently have an easy way to do that.

    What you can do is set the default zoom level when loading with this code snippet:

    // Set add listing map default zoom level
    add_action('geodir_address_extra_listing_fields', function( $cf ) {
      
    	global $gd_post,$mapzoom;
    	if(empty($gd_post->mapzoom)){
    		$mapzoom = 16;
    	}
    });

    Stiofan

    Thank you Stiofan. I will test it now…

    Hi Stiofan,

    I settled with setting the line 94 in map.php to:
    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 16;?>; // the zoom as we need
    My other question remains standing: how can I make that map (on the add new listing page) non-responsive to scroll-wheel on desktop and one-finger motion on mobile?

    Many thanks!
    Eugene

    Plugin Author Stiofan

    (@stiofansisland)

    Hi Eugene,

    You can add params to the map with this action,

    add_action('geodir_template_render_map_js_params','my_add_map_no_zoom');
    function my_add_map_no_zoom(){
    	 echo 'scrollwheel: false,';
    }

    Thanks,

    Stiofan

    Dear Stiofan,
    Just found your answer and tested it.
    Needless to say “It Works!”
    Just like every response from you – Thank you very much indeed.
    Eugene

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Zoom in on the map at the time of geocoding the address’ is closed to new replies.