Plotting 140K points in leafletjs

You have 2 common options: Display your points in a Canvas-based layer, like using Circle Markers and force rendering them on a Canvas instead of SVG (see also Leaflet MaskCanvas plugin). Circle Markers, even on a canvas, still emit events, so you can detect “click” etc. Use a clustering plugin, like Leaflet.markercluster plugin that you … Read more

Embedding a Leaflet map on a Blazor SPA

Note: The sample code below was created and tested in a WebAssembly Blazor App stand alone… An object reference is required for the nonstatic field, method, or property ‘member’ Let’s create the object class, whose object reference will be passed to your JavaScript’s object when initialized. When the user clicks on a location on the … Read more

Using several Marker Cluster Groups displays overlapping Clusters

The issue is that each Leaflet Marker Cluster Group (i.e. L.markerClusterGroup) will perform its own clustering and render Clusters irrespective of what other Cluster Groups may display. Therefore if you have some individual Markers (or any point Features) that are in different Cluster Groups but close to each other, these Groups will display Clusters also … Read more

Leaflet changing Marker color

So this is one of the top hits in Google for styling Leaflet Icon, but it didn’t have a solution that worked without third parties, and I was having this problem in React as we needed dynamic colours for our routes and icons. The solution I came up with was to use Leaflet.DivIcon html attribute, … Read more