unicef/shapefile-ingest

Name: shapefile-ingest

Owner: unicef

Description: null

Created: 2017-04-03 19:47:22.0

Updated: 2017-04-03 19:47:36.0

Pushed: 2017-10-11 17:10:23.0

Homepage: null

Size: 66

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

This is a component of MagicBox

Set up
npm install
cp config-sample.js config.js
bash setup.sh
Install postgres

sudo apt-get install postgis

Install GDAL/OGR on ubuntu

sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get install gdal-bin

Get shapefiles for all countries from gadm.org

node download_shapefiles_from_gadm.js -s gadm2-8

Zipped shape files will be downloaded to directory in data directory.

Get shapeefile for Colombia from Santiblanko

clone repo: https://github.com/santiblanko/colombia.geojson shp2pgsql -s 4326 -D -I santiblanko/mpio.shp col_2_santiblanko | psql all_countries

Import shapefiles to postgres
Convert shapefiles to geojson

node shapefile_to_geojson -s gadm2-8

rm ./data/geojson/gadm2-8/CAN_0.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CAN_0.json data/shapefiles/CAN/CAN_adm0.shp rm ./data/geojson/gadm2-8/CAN_1.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CAN_1.json data/shapefiles/CAN/CAN_adm1.shp rm ./data/geojson/gadm2-8/CAN_2.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CAN_2.json data/shapefiles/CAN/CAN_adm2.shp rm ./data/geojson/gadm2-8/CAN_3.json; ogr2ogr -f GeoJSON -lco COORDINATE_PRECISION=8 data/geojson/gadm2-8/CAN_3.json data/shapefiles/CAN/CAN_adm3.shp

rm ./data/geojson/gadm2-8/CHL_0.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CHL_0.json data/shapefiles/CHL/CHL_adm0.shp rm ./data/geojson/gadm2-8/CHL_1.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CHL_1.json data/shapefiles/CHL/CHL_adm1.shp rm ./data/geojson/gadm2-8/CHL_2.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CHL_2.json data/shapefiles/CHL/CHL_adm2.shp rm ./data/geojson/geojson/gadm2-8/CHL_3.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/CHL_3.json data/shapefiles/CHL/CHL_adm3.shp rm ./data/geojson/gadm2-8/USA_0.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/USA_0.json data/shapefiles/USA/USA_adm0.shp rm ./data/geojson/gadm2-8/USA_1.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/USA_1.json data/shapefiles/USA/USA_adm1.shp rm ./data/geojson/gadm2-8/USA_2.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/USA_2.json data/shapefiles/USA/USA_adm2.shp rm ./data/geojson/gadm2-8/AUS_2.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/AUS_2.json data/shapefiles/AUS/AUS_adm2.shp rm ./data/geojson/gadm2-8/THA_3.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/THA_3.json data/shapefiles/THA/THA_adm3.shp rm ./data/geojson/gadm2-8/VNM_3.json; ogr2ogr -f GeoJSON data/ggeojson/adm2-8/VNM_3.json data/shapefiles/VNM/VNM_adm3.shp rm ./data/geojson/gadm2-8/PRT_3.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/PRT_3.json data/shapefiles/PRT/PRT_adm3.shp rm ./data/geojson/gadm2-8/ZAF_4.json; ogr2ogr -f GeoJSON data/geojson/gadm2-8/ZAF_4.json data/shapefiles/ZAF/ZAF_adm4.shp

ogr2ogr -f GeoJSON ./geo./shapefiles/gadm2-8/CHL/CHL_adm0.shp


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.