Created
July 16, 2014 16:18
-
-
Save cquest/d1734a71c3a4a18587fe to your computer and use it in GitHub Desktop.
osm2pgsql point density mapnik query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(SELECT box, floor(10*log(count(*)+1)) AS nb | |
FROM planet_osm_point | |
JOIN | |
(SELECT ST_setSRID(ST_Makebox2D(ST_MakePoint(st_xmin(!bbox!)+x*!pixel_width!, st_ymin(!bbox!)+!pixel_height!*y),ST_MakePoint(st_xmin(!bbox!)+(x+1)*!pixel_width!,st_ymin(!bbox!)+!pixel_height!*(y+1))),900913) AS box | |
FROM | |
(SELECT generate_series(0,255) AS x) AS h, | |
(SELECT generate_series(0,255) AS y) AS v) AS b ON (way && b.box) group by b.box) AS density |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment