Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google is not defined #173

Closed
massimiliamanto74 opened this issue Sep 22, 2021 · 1 comment
Closed

google is not defined #173

massimiliamanto74 opened this issue Sep 22, 2021 · 1 comment

Comments

@massimiliamanto74
Copy link

massimiliamanto74 commented Sep 22, 2021

Hi all,
I have integrated overlapping-marker-spiderfier in my TS project.
I load the google api javascript by script in html file and then I load my class where I imports OverlappingMarkerSpiderfier from 'overlapping-marker-spiderfier' but when I use it

const oms = new OverlappingMarkerSpiderfier(this.gmap, this.options);

I receive this error

oms.js:17 Uncaught ReferenceError: google is not defined
    at oms.js:17
    at Object../node_modules/overlapping-marker-spiderfier/lib/oms.js (oms.js:751)
    at __webpack_require__ (bootstrap:19)
    at Module../src/classes/googleMap.ts (utils.js:351)
    at __webpack_require__ (bootstrap:19)
    at Module../src/classes/mapprovider.ts (kakaoMap.ts:431)
    at __webpack_require__ (bootstrap:19)
    at Module../src/classes/onthemap.ts (mapprovider.ts:138)
    at __webpack_require__ (bootstrap:19)
    at onthemap-js-api.min.js:21088

In same block code I check if I need to use MarkerCluster or OverlappingMarkerSpiderfier, both need google map api is loaded. First case (markerCluster) works, second (OverlappingMarkerSpiderfier) don't works.

 if (this._otm?.mcOptions as MarkerClustererOptions) {
....this._cluster = new MarkerClusterer(this._gmap, [], this.mcOptions);
}  else if (this._otm?.olOptions && this._gmap) {
      const oms = new OverlappingMarkerSpiderfier(this._gmap, this.olOptions);
} else {
      this.markers.forEach((marker: google.maps.Marker) => {
        marker.setMap(this._gmap);
      });
    }
@massimiliamanto74
Copy link
Author

Sorry I wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant