// This function accepts lat longitude from a string and then creates LatLng object which you can pass to different functions/objects.
// e.g. 123,-234
function getLatLngFromString(ll) {
var lat = ll.replace(/\s*\,.*/, ''); // first 123
var lng = ll.replace(/.*,\s*/, ''); // second ,456
var latLng = new google.maps.LatLng(parseFloat(lat), parseFloat(lng));
return latLng;
}
Here is a formatted code from github.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer