Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use Leaflet and OSM with density map and clustering #37

Open
yohanboniface opened this Issue · 3 comments

2 participants

@yohanboniface
Collaborator

As we discussed, I'm starting a branch to work on:

  • moving to Leaflet
  • using OSM tiles (which rendering? Thunderforest has nice ones: http://www.thunderforest.com/ )
  • using some density (choropleth) map at low zoom levels
  • using some client clustering at intermediate/high zoom levels

About the density map: do we want to group per country? Something like this: http://leaflet.cloudmade.com/examples/choropleth.html ?

About the clustering, maybe using the @danzel plugin could do the job: http://danzel.github.com/Leaflet.markercluster/example/marker-clustering-realworld.388.html

@brutasse
Owner

Thanks for the proposal :)

+1 for leaflet

+1 for OSM tiles, we just need a provider able to handle a decent amount of traffic for free (or in exchange of some sort of acknowledgment on the site like we do with Heroku). I don't know what's the traffic like at the moment though.

+1 for the clustering plugin, coupled with an ajax view that returns geoJSON given a client's bounding box it'd work great.

As for density maps: I was thinking about something a bit more advanced than per-country grouping. E.g. implement the marching squares[0] algorithm to determine the boundaries for a given number of density levels, then simply draw those boundaries as leaflet polygons, with a smoothFactor that makes them look good.

Each polygon could have a solid border and a given opacity, for high density zones they'd stack and the overall opacity would increase as the density increases. What do you think of this approach? Polygons should obviously be computed on a daily (or so) basis and cached somewhere. We have redis or postgres for that.

The main limitation is that the current Heroku database plan doesn't support PostGIS. We could ask @jacobian if we can upgrade it but it's something like 5x more expensive. Naive bounding box queries would work at the moment without postgis though so it's probably not blocking anything.

Ping me on IRC if you need some anonymized data!

[0] http://en.wikipedia.org/wiki/Marching_squares

@yohanboniface
Collaborator

I suggest an iterative work, something like:

  1. migrating to Leaflet and OSM
  2. making a simple country based density map for low zoom levels
  3. using ajax GeoJSON and clusters for intermediate zoom levels
  4. implementing a better density map algorithm

What do you think?

@brutasse
Owner

Totally agreed, let's not break all the things at once.

@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - First shot in using Leaflet instead of Gmap 5dca34d
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Update "about" page to mention Leaflet and OSM 178ce98
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - peopleArray is no more used b811b37
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Fix the broken nearest persons list in profile page
It has been broken in the initial commit.
61d03cf
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Fix wrong links color in map popup 48b2e14
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Use non compressed leaflet source only in debug mode
Note that you must have DEBUG=True AND your IP in the INTERNAL_IPS to
use the non compressed version.
4e0305b
@yohanboniface yohanboniface referenced this issue
Closed

Osm #39

@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Serve locally the leaflet statics
Goals:
- serve them in HTTPS
- minify them with our solutions
5cecad0
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Naive client clustering implementation with 1000 mar…
…kers

This is just a Proof-of-Concept with the leaflet-markercluster plugin.
813ed44
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cd brutasse#37 - First POC of a TileLayer asynchrone and clustered class
Work in progress!
2514421
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Update requirements to use tilestache b0c33a8
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Uncouple image tiles and geojson giles loading 930f734
@yohanboniface yohanboniface referenced this issue from a commit in yohanboniface/djangopeople
@yohanboniface yohanboniface cf brutasse#37 - Poor man client-sive clustering algorithm
Basicaly:
- divide the world in a grids, sized according to zoom level
- for each point, calculate the closest grid node
- take a "random" point of the cluster to set the center

But well, we have a POC working, let's refine it now :)
9ad5d27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.