Closed jimmykane closed 4 years ago
import { MarkerClusterer } from '@google/markerclustererplus/dist/markerclusterer';
should be
import { MarkerClusterer } from '@google/markerclustererplus';
Well that is how I tried at start but I got
ERROR in src/app/components/events-map/events-map.component.ts:17:10 - error TS2614: Module '"../../../../node_modules/@google/markerclustererplus/dist"' has no exported member 'MarkerClusterer'. Did you mean to use 'import MarkerClusterer from "../../../../node_modules/@google/markerclustererplus/dist"' instead?
17 import { MarkerClusterer } from '@google/markerclustererplus';
Then I tried the editor auto import and that changed it to
import { MarkerClusterer } from '@google/markerclustererplus/dist/markerclusterer';
Looking at the index.d.ts from this lib
These are the contents:
/**
* Copyright 2019 Google LLC. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MarkerClusterer } from "./markerclusterer";
export { ClusterIconInfo, ClusterIconStyle } from "./cluster-icon";
export { MarkerClustererOptions } from "./markerclusterer";
export default MarkerClusterer;
This is actually a case of a default export. Sorry I missed that. The following should work. I added the MarkerClustererOptions
to show combining default and named exports.
import MarkerClusterer, { MarkerClustererOptions } from '@google/markerclustererplus'
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Syntax for more information.
Thank you for the help. It was not really apparent to me somehow. Perhaps the first error at first try late at night confused me.
@jimmykane Hi, I am trying to use the @google/markerclustererplus with Angular 9 too but I am stuck in initiating the MarkerClusterer and show it on the map, if you managed to make it or found an example about I really can use some help here, thanks
Sure. Search at my repos for quantified-self and look at the heatmaps / cluster component.
I am a bit off laptop ATM so cannot help in detail.
It's well possible also combined with agm maps.
Alternatively let's email
On Thu, 25 Jun 2020, 14:36 TahaAlkhatib, notifications@github.com wrote:
@jimmykane https://github.com/jimmykane Hi, I am trying to use the @google/markerclustererplus with Angular 9 too but I am stuck in initiating the MarkerClusterer and show it on the map, if you managed to make it or found an example about I really can use some help here, thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlemaps/v3-utility-library/issues/615#issuecomment-649513776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVX4ZOTLPIP2RZAZJ2KPDRYNAFDANCNFSM4KTHCGDA .
@jimmykane thanks alot, I see you are using @agm/core, I used @angular/google-maps in my project,I will check your code and try to understand how to do it with @angular/google-maps or I will switch to use agm instead.
@TahaAlkhatib here you go
Its a combination of using Both AGM + native map. I think it aint so complicated
@jimmykane I noticed the "events-map" component once I looked at the quantified-self repo and realized this is exactly what I needed, I managed to make it work in my project now using almost the same code and method. thanks for your great help and thanks for taking from your time to answer me.
Version ^5.0.1
Angular 9
Package
Usage:
No clue why this fails but I think ive not done anything wrong