Google Static Maps API - Error while encoding polyline
I'm using google maps' Interactive Polyline Encoder Utility to plot locations on a map. When I try to plot 31.63089000, 74.87155200, I get an error "Invalid location entered. M开发者_如何学JAVAust be in range of -90 to 90".
Seems to be a problem with the form code here:
var lat = document.getElementById('txtLatitude').value;
var pLat = parseFloat(lat);
if (pLat.toString() != lat) {
alert('Invalid latitude entered. Must be in range of -90 to 90');
return;
}
It works for me if I truncate your numbers to 31.63089 and 74.871552. The problem in that javascript is that parseFloat is truncating the trailing zeroes off the end. So it converts 31.63089000 to 31.63089. And then 31.63089 is != what was entered in the form, 31.63089000, hence the error. Suggest you file this as a bug with whoever's responsible.
精彩评论