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

Feature: Create integration of demographic data sets as Choropleth layers #12

Open
kidwellj opened this issue Jul 3, 2017 · 4 comments
Assignees

Comments

@kidwellj
Copy link
Member

kidwellj commented Jul 3, 2017

I'm thinking here of the 2011 UK Census, Scottish Index of Multiple Deprivation, and UR 6 fold scale. Once these are integrated then we can start to fill in data in the pane/D3 viz.

@kidwellj
Copy link
Member Author

kidwellj commented Jul 3, 2017

See good (if slightly more full featured that we would aim for) example here: http://climate.globalforestwatch.org/map/3/15.00/27.00/ALL/dark/biomass_loss?begin=2001-11-10&end=2015-01-01&threshold=30 with code deposited here: or this one, with code here: https://github.com/Vizzuality/gfw-climate

@danhillcode
Copy link
Collaborator

progress

@kidwellj
Copy link
Member Author

So here's what needs to be done, I think:

(1) Calculate bounding box for current leaflet map instance displayed onscreen using map.getBounds();
see here: https://stackoverflow.com/questions/22948096/get-the-bounding-box-of-the-visible-leaflet-map#22949388

(1b) Set variables to pass to postgis query based on above bounds (?)

(1c) Set max/min zoom to prevent map from loading too much data at high zoom levels. Basically, > zoom level 4 we should not display any data; between zoom levels 4-8 display a simplified set of polygons

...there are UX considerations here as zoom level will impact the size of data in the query. Options: we could (i) auto-set zoom to minimum if user clicks on an analysis layer or (ii) display light-touch error message to warn them that polygons won't display until zoom level is close enough or (iii) simplify geometries for high zoom levels (see here http://strk.kbt.io/blog/2013/03/08/on-the-fly-simplification-of-topologically-defined-geometries/) or (iv) use alternative data set for high zoom levels.

(2) Query 'demographics' PostGIS database for any objects inside/intersected by this bounding box, something like this I think:

SELECT *
FROM 2011_OAC
WHERE 
  mytable.geom && ST_MakeEnvelope(minLon, minLat, maxLon, maxLat);

see here: https://gis.stackexchange.com/questions/25797/select-bounding-box-using-postgis?rq=1

(3) Display these objects as polygons in a new layer on the leaflet map

An alternative for (1-2) would be to pre-cache all the images using a tileserver like mapnik. I'm pretty sure what these guys here are doing: http://simd.scot/2016/#/simd2016. I think this option may be overly server-heavy and not the most programmatically elegant solution...

@kidwellj kidwellj changed the title Create integration of demographic data sets as Choropleth layers Feature: Create integration of demographic data sets as Choropleth layers Aug 31, 2017
@danhillcode
Copy link
Collaborator

Just checked DVF library works on its own with the map but struggles with the marker cluster need to look into this more would it be an option to have a separate map with these layers?

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