BIOSTALL / CodeIgniter-Google-Maps-V3-API-Library

The library enables you to create a map and overlay multiple markers, polylines, polygons, rectangles, ground overlays and/or circles, all of which are fully customisable. The library also supports showing directions between two points, including the ability to show the textual directions alongside the map too, and marker clustering. The first stages of integration with the Google Places API are available for use too.
http://biostall.com/codeigniter-google-maps-v3-api-library
288 stars 199 forks source link

Geolocation returning 0,0 for all addresses #53

Closed sparky672 closed 7 years ago

sparky672 commented 7 years ago

I have two CodeIgniter projects both using the same version of your software. Neither project is using an API key. Both take a street address and use Google Maps geolocation to get coordinates.

Both projects worked fine until recently and none of my code has changed. On one project, the geolocation coordinates for ALL addresses are coming back 0,0 with no error message.

$this->load->library('googlemaps');
$location = $data['this_event']['location']; // street address
$geocode = $this->googlemaps->get_lat_long_from_address($location);
$config_map = array(
    'center'    => $location,
    'map_width'  => '375px',
    'map_height' => '300px',
    'map_type'    => 'TERRAIN',
    'zoom'    => 13,
    'ontilesloaded' => 'iw_map.setContent(marker_0.get("content"));'
);
$marker_map = array(
    'position'    => $location,
    'infowindow_content'  => '<div class="infobox">' . $location . '</div>'
);
$this->googlemaps->initialize($config_map);
$this->googlemaps->add_marker($marker_map);
$data['map'] = $this->googlemaps->create_map();

And then in the rendered view, I'm getting latitude and longitude as 0, 0 in the generated JavaScript.

var myLatlng = new google.maps.LatLng(0, 0);

I'm at a loss trying to figure out why it's suddenly failing in one of my two websites.

sparky672 commented 7 years ago

Something must have changed with how Google interprets the street address. Where the name of the business used to be ignore/acceptable is now causing geolocation to return 0,0 lat/lng coordinates.

Everything works fine when the name of the business is removed from the street address string.