Skip to content

Instantly share code, notes, and snippets.

@tyrasd
Last active May 9, 2022 18:08
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tyrasd/5879119 to your computer and use it in GitHub Desktop.
This is how I've visualized OpenStreetMap's node density.
  1. download the source data

     wget http://fred.dev.openstreetmap.org/density/tiles.13
     wget http://fred.dev.openstreetmap.org/density/tiles.16
    
  2. convert to simple, gnuplot-readable text format

     sed 's/\([0-9]*\) z=\([0-9]*\) x=\([0-9]*\) y=\([0-9]*\)/\3 \4 \1/' < tiles.13 > tiles.13.txt
     sed 's/\([0-9]*\) z=\([0-9]*\) x=\([0-9]*\) y=\([0-9]*\)/\3 \4 \1/' < tiles.16 > tiles.16.txt
    
  3. start gnuplot

     gnuplot
    
  4. use gnuplot to create the map

     reset
     unset xtics
     unset ytics
     unset border
     unset key
     unset legend
     unset title
     set lmargin at screen 0
     set tmargin at screen 0
     set rmargin at screen 1
     set bmargin at screen 1
     
     set palette rgbformulae 34,35,36
     
     width = 1024
     
     set xrange [0:width-1]
     set yrange [0:width]
     
     set object rectangle from screen 0,0 to screen 1,1 fillcolor rgb"#000000" behind
     
     set terminal png size width,width
     set output "density.13.png"
     
     plot 'tiles.13.txt' using ($1/8):(width-1-$2/8):(log($3)) with dots palette
    
  5. repeat with zoom-16 tiles (don't forget to adapt the numbers above)

  6. results and more information

@femtope
Copy link

femtope commented May 5, 2016

Please Fred, is there a way to specify for Africa alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment