[Solved] Displaying marker with latlong json data in Biostall-google-maps-V3 API Library issue


The problem is google.maps.LatLng is expecting two numbers and you are passing it a string from your database (assuming searchMapDataResult[‘latlong’] is returning a comma delimited string). So you will need to

  1. Split the latitude and longitude
  2. Convert them into numbers
  3. Generate the google.maps.LatLng

Like this:

var latLngArray = searchMapDataResult['latlong'].split(',');
var latitude = parseFloat(latLngArray[0]);
var longitude = parseFloat(latLngArray[1]);
var myLatLong = new google.maps.LatLng(latitude,longitude );

2

solved Displaying marker with latlong json data in Biostall-google-maps-V3 API Library issue