OverlappingMarkerSpiderfier
OverlappingMarkerSpiderfier copied to clipboard
OverlappingMarkerSpiderfier is not defined
Hi,
I dowloaded the min js file lib and include the code directly in my JS file ( on top ). But when I tried to instanciate the OverlappingMarkerSpiderfier Object I have the following error :
Uncaught ReferenceError: OverlappingMarkerSpiderfier is not defined
Thanks in advance
Solved by changing the init test in contructor : this.google in google.
Thanks for your work !
Very usefull tool for map
Would you mind explaining your fix? I was able to solve the issue on my side by loading the script after Google Maps.
I just replaced in minify file A=this.google by A=google and i worked for me.
Keep in mind to load google map API "before" ( to have the google variable defined ) injecting" overlapping lib
The important thing here is getting the google maps API to load before the OMS library. At least for me, the line change is not necessary. Thanks for the tip it helped me solve the issue.
I tried to replace file A=this.google by A=google, but it doesnt work for me. I still have "OverlappingMarkerSpiderfier is not defined"
Google maps must load before OMS, and this can be a problem if using async defer. This is what I did to resolve the issue - first, load the Google Maps API in the head:
<script async defer src="https://maps.googleapis.com/maps/api/js?library=places"></script>
Then load OMS with just defer in the footer or before the closing body tag:
<script defer src="[your_url]/oms.min.js"></script>
This solved the OMS undefined problem for me by deferring the loading of OMS until after all preceding scripts have been loaded.
I know why i have the problem. I actually have Google Map loads before OMS for sure, but it didnt solve my problem. The problem occurs when I put the OverlappingMarkerSpdierfier inside function initMap() {}. I change function initMap() {} to window.onload = function(){} and it works. I dont know why it doesnt work eventhough I have the script such as:
tenznhok, thank you so much for your correct resolution. It is work perfectly with google mas v3.28.7 in all browsers (ie11, FF, Ch, Edge).