Make a hazard-map MBTiles app

Bug #1097679 reported by Ben Wyss
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Platform
Fix Committed
Undecided
Ben Wyss

Bug Description

This will involve gathering requirements, gathering and formatting data, pre-processing data, then adding the data into a tilemill project, activate some kind of interactivity (as needed), rendering the interactivity as a text, a table, or a chart (as needed) and then finally mix the layer(s) into a leaflet/wax app.

Tags: mbtiles ui
Revision history for this message
Ben Wyss (bmwyss) wrote :

For this task we decided to use MBTiles format for the data as it provides very fast rendering to the client.

1. The hazard map data is vector data in a grid. The hazard map data was first transformed from csv to shapefile.

2. The data was then interpolated into a raster with:
gdal_grid -a invdist:power=1.5:smoothing=1.0 -outsize 3000 3000 -txe -180 -180 -tye -80 80 -zfield iml -co "iml=iml" -ot iml -of GTiff -l temp2 map_world_complete_PGA_0.1.shp haz_world_interp_1.5

3. This raster was then converted into a contour map. To do this I used the Gdal contour:
gdal_contour -a ELEV -i 0.01 "<path to input raster> <path to output shapefile>

4. Clip the contours that are outside of the landmass. download natural earth land area: http://www.naturalearthdata.com/downloads/10m-physical-vectors/ then clip the contour layer against the natural earth layer

5. Load the shapefile into tilemill and style:
@color:rgb(255,0,0);

#hazard_contour {
  line-width:1;
  [zoom < 13] { line-width: .5}
  line-opacity:.4;
  line-join:round;
  line-gamma:1;
  line-join:round;
  line-smooth:1;
  [ELEV <= 0.595] { line-color:spin(@color, 355); line-width: 9; }
  [ELEV <= 0.55] { line-color:spin(@color, 355); line-width: 8; }
  [ELEV <= 0.5] { line-color:spin(@color, 350); line-width: 7.7; }
  [ELEV <= 0.25] { line-color:spin(@color, 350); line-width: 7.5; }
  [ELEV <= 0.23] { line-color:spin(@color, 1); line-width: 7.3; }
  [ELEV <= 0.22] { line-color:spin(@color, 1); line-width: 7; }
  [ELEV <= 0.21] { line-color:spin(@color, 5); line-width: 6.7; }
  [ELEV <= 0.20] { line-color:spin(@color, 5); line-width: 6.5; }
  [ELEV <= 0.19] { line-color:spin(@color, 10); line-width: 6.3; }
  [ELEV <= 0.18] { line-color:spin(@color, 10); line-width: 6; }
  [ELEV <= 0.17] { line-color:spin(@color, 15); line-width: 5.7; }
  [ELEV <= 0.16] { line-color:spin(@color, 15); line-width: 5.5; }
  [ELEV <= 0.15] { line-color:spin(@color, 20); line-width: 5.3; }
  [ELEV <= 0.14] { line-color:spin(@color, 20); line-width: 5; }
  [ELEV <= 0.13] { line-color:spin(@color, 25); line-width: 4.7; }
  [ELEV <= 0.12] { line-color:spin(@color, 25); line-width: 4.5; }
  [ELEV <= 0.11] { line-color:spin(@color, 30); line-width: 4.3; }
  [ELEV <= 0.10] { line-color:spin(@color, 35); line-width: 4; }
  [ELEV <= 0.09] { line-color:spin(@color, 42); line-width: 3.7; }
  [ELEV <= 0.08] { line-color:spin(@color, 47); line-width: 3.5; }
  [ELEV <= 0.07] { line-color:spin(@color, 53); line-width: 3.3; }
  [ELEV <= 0.06] { line-color:spin(@color, 75); line-width: 3; }
  [ELEV <= 0.05] { line-color:spin(@color, 80); line-width: 2.7; }
  [ELEV <= 0.04] { line-color:spin(@color, 65); line-width: 2.5; line-opacity:0;}
  [ELEV <= 0.03] { line-color:spin(@color, 70); line-width: 2.3; line-opacity:0;}
  [ELEV <= 0.02] { line-color:spin(@color, 75); line-width: 2; line-opacity:0; }
  [ELEV <= 0.01] { line-color:spin(@color, 80); line-width: 1; line-opacity:0;}
  [ELEV <= 0.005] { line-color:spin(@color, 180); line-width:.6; }
  [ELEV <= 0] { line-color:spin(@color, 0); }
}

Revision history for this message
Ben Wyss (bmwyss) wrote :

suggested color ramp for the hazard map raster:

 0.00 255 255 255 0.02 255 255 255
 0.02 152 251 152 0.04 152 251 152
 0.04 39 139 34 0.08 39 139 34
 0.08 255 246 143 0.16 255 246 143
 0.16 238 201 0 0.24 238 201 0
 0.24 255 130 71 0.32 255 130 71
 0.32 238 64 0 0.40 238 64 0
 0.40 205 51 51 0.48 205 51 51
 0.48 142 56 142 0.80 142 56 142
B 255 255 255
F 142 56 142
N 0 0 0

Revision history for this message
Ben Wyss (bmwyss) wrote :

This bug has been brocken into two:

Create vector Hazard Map using mbtiles
https://bugs.launchpad.net/openquake/+bug/1157223

&

Create contour Hazard Map using mbtiles
https://bugs.launchpad.net/openquake/+bug/1157224

Ben Wyss (bmwyss)
summary: - Make a hazard-map/curve MBTiles app
+ Make a hazard-map MBTiles app
Changed in openquake:
status: New → Confirmed
Revision history for this message
Ben Wyss (bmwyss) wrote :
Changed in openquake:
status: Confirmed → Fix Committed
Ben Wyss (bmwyss)
no longer affects: openquake
Changed in oq-platform:
status: New → Fix Released
status: Fix Released → Fix Committed
assignee: nobody → Ben Wyss (bmwyss)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.