Skip to content

Instantly share code, notes, and snippets.

@danbjoseph
Last active August 27, 2019 12:24
Show Gist options
  • Save danbjoseph/28b9db27d6af664a865a to your computer and use it in GitHub Desktop.
Save danbjoseph/28b9db27d6af664a865a to your computer and use it in GitHub Desktop.
notes on OpenMapKit (OMK), specifically mbtiles and osm files

#OpenMapKit (OMK) https://github.com/AmericanRedCross/OpenMapKit/wiki

  • install node
    • install the following packages tl, mbtiles, tilelive-http
    • npm install -g tl @mapbox/mbtiles tilelive-http
  • go to http://bboxfinder.com/ and box your area
    • should return your cooridinates in the following order: lng-min, lat-min, lng-max, lat-max
  • open terminal/command line and cd to your project folder and run the following:
    • tl copy -z 13 -Z 20 -b '{{lng-min}} {{lat-min}} {{lng-max}} {{lat-max}}' 'http://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png' mbtiles://./{{myFileName}}.mbtiles
    • note that the HOT humanitarian tiles only render down to zoom 20
    • it should begin saving the map tile images one by one and compiling them in the folder
    • note: larger areas can take a number of hours
    • it can be useful to run this on an Amazon EC2 instance
    • helpful tools are screen for keeping the process running without keeping the terminal window open, and s3fs for moving the mbtiles files to S3 storage for easy access and sharing
  • change the coordinates order to lat-min, lng-min, lat-max, lng-max (2, 1, 4, 3) and add back the commas
  • go to http://overpass-turbo.eu/ and enter the following:
    • way[building]({{lat-min}}, {{lng-min}}, {{lat-max}}, {{lng-max}});out meta;>;out meta qt;
    • click Run and continue anyway if a warning pops up
    • click Export and choose raw data directly from Overpass API and add a *.osm file extension when saving
  • copy both files to your phone
    • in the root directory there should be openmapkit/mbtiles and openmapkit/osm
    • copy the files into the respective folders
@danbjoseph
Copy link
Author

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