How to get center lat/lng individually?
I was wondering if there are any methods to get the current center
lat/lng of a map individually as opposed to a coordinate like with
map.getCenterLatLng(). Right now, I am using map.getCenterLatLng() then
trying to use javascript to break up the string. This would work, but
I'm having trouble removing the ( and ) from the string. So far this is
what I've got:
var centerPoint = "";
centerPoint += map.getCenterLatLng();
centerPoint.replace(/\(/g,'');
centerPoint.replace(/ /g,'');
var currentCenter = centerPoint.split(',');
The problem is with the third line because it never finds the string (
and if I don't escape the ( then the script breaks. Any help is greatly
appreciated.
0 Comments:
Yorum Gönder
<< Home