0

My map redraws seem to be failing because (at the least) I have been dynamically setting the center via

var currCenter = gmap.getCenter();

Then:

var mapOptions = {
    center: new google.maps.LatLng(currCenter.ob, currCenter.pb),
    zoom: currZoom,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};

Appears currCenter.ob is suddenly undefined this morning. It now looks like it's pb & qb instead of ob & pb. I'm in the process of trying to fix the code, is there anything else anyone knows of that was changed?

EDIT: They're undocumented API fields I shouldn't be using, nevermind I fixed it with the info below. Thanks.

gjw80
  • 1,058
  • 4
  • 18
  • 36
  • possible duplicate of [Google Maps API V3 - only showing a blank map when using the geocder](http://stackoverflow.com/questions/13114797/google-maps-api-v3-only-showing-a-blank-map-when-using-the-geocder). You are using undocumented internal properties of the API, those can and do change with every release. – geocodezip Dec 05 '13 at 14:23
  • 1
    Possible duplicate of [google.maps.Geocoder.geocode() geometry.location lat/lng property names change frequently](http://stackoverflow.com/questions/13499111/google-maps-geocoder-geocode-geometry-location-lat-lng-property-names-change-f/13499500#13499500) – geocodezip Dec 05 '13 at 14:25

4 Answers4

1

I am assuming gmap is a google map object. If that is the case, then getCenter already returns a LatLng object, so creating a new object via

new google.maps.LatLng()

Is somewhat useless, you could simply use currCenter directly.

ndpu
  • 22,225
  • 6
  • 54
  • 69
JCHebert
  • 83
  • 5
1

The problem is that Api Google maps constantly changing this values (ob, .pb) to Latitude and Longitude, you must use lat() and lng() functions to have a stable version

var mapOptions = {
center: new google.maps.LatLng(currCenter.lat(), currCenter.lng()),
zoom: currZoom,
mapTypeId: google.maps.MapTypeId.ROADMAP

};

greetings!

borchvm
  • 3,533
  • 16
  • 44
  • 45
0

To answer you question. YES. Google Maps API did changed last night. I was doing the same thing you did (calling .ob and .pb), but found that I had to change them to .pb and .qb in my code respectively in order to get the Lat and Long.

0

Rewrote them as .lng() and .lat() instead of .ob, .pb, .qp. I believe that these members should be more stable if you still want to use unofficial member names.

Léon Pelletier
  • 2,701
  • 2
  • 40
  • 67