an
groups-icon

Allow to center Maps on address without long/lat

Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
  • Version 9
    A M
    0 points
    Beginner

    Hi Mark,

    May I suggest to allow the option of using “Address” from map_location to render and adjust the map instead of Long/Lat.
    The reason I mention that, is mainly when importing from CSV, I happen to have a list of addresses but not necessary Longs/Lats but I still would like the maps to work.

    My work around for now is to modify class_white_label_themes.php

    By adding below line 7880:

    $map_location = get_post_meta($post->ID,'map_location',true);
    if($map_long == "" && $map_location == ""){ return; }

    and adding geo location specific gmaps

    as follows:


    geocoder = new google.maps.Geocoder();
    geocoder.geocode({
    \'address\': \''.get_post_meta($post->ID,'map_location',true).'\'
    }, function(results, status) {

    if (status == google.maps.GeocoderStatus.OK) {
    var myOptions = {
    zoom: 8,
    center: results[0].geometry.location,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("wlt_google_maps_div"), myOptions);
    var image = new google.maps.MarkerImage(\''.get_template_directory_uri().'/framework/img/map/icon.png\');
    var shadow = new google.maps.MarkerImage(\''.get_template_directory_uri().'/framework/img/map/shadow.png\');
    var marker = new google.maps.Marker({
    position: results[0].geometry.location,
    map: map,
    shadow: shadow,
    icon: image
    });
    }
    });

    November 1, 2013 at 11:29 pm
  • Mark Fail
    11,845 points
    Platinum User
    Bronze User Silver User Gold User Platinum User Helpful Award Fast Responder Thank You Coffee Villian Award Video Testimonial
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    November 3, 2013 at 10:08 am

593

Views

1

Replies