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

Unable to use this library with Canvas markers #113

Closed
FatehAK opened this issue Jul 5, 2020 · 2 comments
Closed

Unable to use this library with Canvas markers #113

FatehAK opened this issue Jul 5, 2020 · 2 comments

Comments

@FatehAK
Copy link

FatehAK commented Jul 5, 2020

I'm trying to use this library along with: https://github.com/lycheelin/react-leaflet-canvas-markers

return (
        <div className={`retailer-mapview ${view === 'Map' ? 'd-block' : 'd-none'}`}>
            <Map
                center={center}
                zoom={12}
                minZoom={12}
                preferCanvas={true}
                zoomControl={false}
                onclick={handleClick}
            >
                <TileLayer
                    attribution='&amp;copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
                    url={`${OSM_URL}/tile/{z}/{x}/{y}.png`}
                />
                <CanvasMarkersLayer>
                    <MarkerClusterGroup chunkedLoading={true}>
                        <Marker position={center} icon={icon}>
                            <Popup>
                                <span>Marker 1</span>
                            </Popup>
                        </Marker>
                        <Marker position={pos1} icon={icon}>
                            <Popup>
                                <span>Marker 2</span>
                                <button type="button" onClick={handleBtnClick}>Click</button>
                            </Popup>
                        </Marker>
                    </MarkerClusterGroup>
                </CanvasMarkersLayer>
            </Map>
        </div>
    );

But it throw the following error: Layer isn't a marker
at MarkerClusterGroup (http://localhost:3000/static/js/1.chunk.js:118211:5)

Can you please guide me on this. I need canvas markers to render thousands of markers optimally. But am unable to do so because of this error. Thanks in advance.

@yuzhva
Copy link
Owner

yuzhva commented Aug 4, 2020

The Leaflet.Canvas-Markers library does not work together with markers clustering.

eJuke/Leaflet.Canvas-Markers#5 (comment)

Here is the answer in React lib:
lycheelin/react-leaflet-canvas-markers#5 (comment)

Looks like only one solution should be used - Canvas or Clusters.

@stale
Copy link

stale bot commented Sep 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 3, 2020
@stale stale bot closed this as completed Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants