Is that possible to check the type of a google map overlay.
var polygon = new G.Polygon();
var rectangle = new G.Rectangle();
var circle = new G.Circle();
var shape;
Now, my code will dynamically assign these overlay to shape variable.
But how can I detect or check the type of an overlay named shape? I can’t find the solution using Google.
You can use
instanceof, but I’d advise against it. It’s not part of the API and could break any time in the future.It would be better to assign an attribute upon initialization.