I just started getting this error today for Google Maps:
Uncaught InvalidValueError: setIcon: not a string; and no url property; and no path property
I haven't changed any code in months.
The error is happening on this page: http://gusmodern.com/pages/store-locator
Has anyone come across this before?
I updated to the specific version reference https://maps.googleapis.com/maps/api/js?v=3&sensor=true and the error went away. I had this across multiple of my geolocation websites and mobile apps.
I got the same error just recently in some of my code. Thanks to another question in the past, I realized that when I set the markers I needed to make sure the variables I was bringing in for the anchor and scaled size were float numbers and not coming in as strings. This must be a new requirement with a recent update.
In my own code I changed
currentIcon = {
url: 'http://www.example.com/img/avatars/'+name+'.png',
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(aw,ah),
scaledSize: new google.maps.Size(w,h)
};
to
currentIcon = {
url: 'http://www.example.com/img/avatars/'+name+'.png',
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(parseFloat(aw),parseFloat(ah)),
scaledSize: new google.maps.Size(parseFloat(w),parseFloat(h))
};
and it now works fine for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With