I'm using Google Maps SDK to show a map on my site. In addition, I'm showing some custom pins using tiles overlays -> https://developers.google.com/maps/documentation/android-sdk/tileoverlay .
I'm inserting an overlay like this:
const tileAdaptor = new SomeAdaptor();
map.overlayMapTypes.insertAt(0, tileAdaptor);
And now, from other part of my code, I want to access that same instance. I was doing it like this:
window.map.overlayMapTypes.je[0];
But, surprisingly, the .je
attribute has been renamed! I do not know if that's because it's an internal API or something like that. Now it has been renamed to .td
.
So, my question is, is there a way to get that first overlay without using internal APIs?
CodePudding user response:
Don't use undocumented properties, they can (and will) change with any new release of the API.
You need the overlayMapTypes property, which is a MVCArray, which has a getArray method
window.map.overlayMapTypes.getArray[0]