I have the following code that builds a custom google map marker like this:
mapa.markers[ind] = new google.maps.Marker({
position: mposition,
map:mapa.map,
title:mapa.json.markers[ind].timestamp,
icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
});
Using this solution here, I am trying to integrate this code into the above but am getting a syntax error? What am I doing wrong?
null, /* size is determined at runtime */
null, /* origin is 0,0 */
null, /* anchor is bottom center of the scaled image */
new google.maps.Size(42, 68)
Here is the updated code that shows a syntax error:
mapa.markers[ind] = new google.maps.Marker({
position: mposition,
map:mapa.map,
title:mapa.json.markers[ind].timestamp,
icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
null, /* size is determined at runtime */
null, /* origin is 0,0 */
null, /* anchor is bottom center of the scaled image */
new google.maps.Size(42, 68)
});
Your syntax is incorrect.
An icon object should be defined like this:
(credit to @andrewap for testing it and the jsfiddle)
The
sizeproperty is not needed (it is automatically set when the image loads), unless you’re using sprites, which is not the case here.Working example: http://jsfiddle.net/fUEDh/