Forum Discussion

Blaenzo's avatar
Blaenzo
Advocate II
7 years ago
Solved

Leaflet.markercluster package in custom visual

Hi,

 

I would like to use the 'Leaflet.markercluster' package in conjuction with the Google Maps API, but I run into the following issue:

 

On a clean custom visual project I ran:

npm i [email protected]
npm i leaflet.markercluster
npm i --save @types/leaflet.markercluster

(installation of '[email protected]' is required upon installation of 'leaflet.markercluster')

 

Then the line (see 'Leaflet.markercluster' package documentation)

var obj = L.masterClusterGroup();

throws the following error:

Property 'masterClusterGroup' does not exist on type 'typeof "C:/pbiviz/testproj/node_modules/@types/leaflet/index"'

I don't understand why it looks at the type script for 'leaflet' and not 'leaflet.markercluster'.

The file 'node_modules\leaflet.markercluster\dist\leaflet.markercluster.js' clearly contains 'MarkerClusterGroup'.

 

I hope someone can help. This should be easy to replicate since it is on a clean project.

 

Thanks!

Martijn

 

 

 

 

 

 

  • Not sure why but it seems to break if either of the following packages are newer than the folling versions:

        "@types/leaflet": "^1.0.69",
        "@types/leaflet.markercluster": "^1.0.0",

    Later I realized this does not work on Google Maps and decided to use a combination of:

    'js-marker-clusterer' and 'OverlappingMarkerSpiderfier'

     

     

     

1 Reply

  • Not sure why but it seems to break if either of the following packages are newer than the folling versions:

        "@types/leaflet": "^1.0.69",
        "@types/leaflet.markercluster": "^1.0.0",

    Later I realized this does not work on Google Maps and decided to use a combination of:

    'js-marker-clusterer' and 'OverlappingMarkerSpiderfier'