ideak / leafclusterer Goto Github PK
View Code? Open in Web Editor NEWPort of the Google Maps MarkerClusterer for Leaflet
Port of the Google Maps MarkerClusterer for Leaflet
The API is similar to that of the Google Maps version ([1]): var map = new L.Map('map'); var lat = ...; var lng = ...; var pos = new L.LatLng(lat, lng); var zoom = 4; map.setView(pos, zoom); var clusterer = new LeafClusterer(map); var lat = ...; var lng = ...; var pos = new L.LatLng(lat, lng); var marker = new L.Marker(pos); clusterer.addMarker(marker); or for batched addition: var markers=[]; for each marker (m) { markers.push(m); } clusterer.addMarkers(markers); [1] http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/
I just wanted to start with leafclusterer, but even the initialization fails?!
In every browser I get a: Uncaught ReferenceError: L is not defined - leafclusterer.js:580
The leaflet map works as expected.
<script type="text/javascript">
var map = new L.Map('map');
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/MY_API_KEY/22677/256/{z}/{x}/{y}.png',
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, { maxZoom: 18, attribution: cloudmadeAttribution });
map.setView(new L.LatLng(51.5, -0.09), 13).addLayer(cloudmade);;
var clusterer = new LeafClusterer(map); // <------- fails
var markers = [];
</script>
Hi, could you provide some images of it in action?
Is it easy to swap out images ourselves?
Please implement the calculation of coordinates of the marker cluster as the average of the coordinates of the markers that belong to the cluster.
In this example http://z-lowicza.pl/mapy/c is drawn incorrectly.
Hello,
I would like to create different LeafClusterer for different markers. At a click of button I would like to hide or to show that cluster ( and the related markers).
When I try to create different LeafClusterer it doesn't work.
Thanks in advance for your time.
-A
Is there a way to use GeoJSON for markers?
The last commit by repo owner was in March, and there have been a few pull requests that appear fine to me, but no maintainer comments. It would be nice to have an updated blessed repository to pull from instead of needing to update my code from multiple other repositories.
So, ideak, do you still watch this repo?
It would be nice if LeafClusterer were to behave more like a LayerGroup. This way the cluster could be added to a Layer Control and allow it to be toggled.
Hello!
Great start on this addon! I hate having to do workaround for old (shitty) browser like IE7, but I did test leafclusterer on IE7 and it didn't work, as IE7 use attachEvent instead of addEventListener.
I know leaflet use a workaround method to go over this issue, would it be easy to implement in leafclusterer?
Thank you !
I found a minor issue when using your library and rendering large clusters with over 1000 markers. The background styling repeats from the bottom and right sides
Example: http://i44.tinypic.com/f02042.png
Hello,
it seems there is a problem with safari firing the onClick_ event.
The clusters doesn't even have pointer cursor when hovered.
The issue is strange, i'm investigating it but the only difference I can notice with leaflet markers is that they use .on() to bind the click event.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.