unicef/download_admin_shapefiles_and_import_geojson_to_elasticsearch

Name: download_admin_shapefiles_and_import_geojson_to_elasticsearch

Owner: unicef

Description: MagicBox

Created: 2016-09-13 16:23:26.0

Updated: 2017-08-16 20:24:20.0

Pushed: 2017-04-11 02:59:52.0

Homepage: null

Size: 64

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Get shapefiles for all countries, store geojson in ElasticSearch

What it does
app.js import_admins_elasticsearch.js Run
node app.js
Import admins to ElasticSearch (For aggegating mobility by airport to admin)

`curl -XPOST localhost:9200/admins -d '{ “mappings”: {

"admin": {
  "properties": {
    "geometry": {
      "type": "geo_shape"
    },
    "ISO": {
      "type": "string"
    },
    "admin_level": {
      "type": "integer"
    },
    "admin_id": {
      "type": "string"
    },
    "pub_src": {
      "type": "string"
    }
  }
}

} }' `

Trouble with Canada and Australia

rm ./data/gadm2-8/CAN* ogr2ogr -f GeoJSON data/gadm2-8/CAN_2.geojson data/unzipped/CAN/CAN_adm2.shp ogr2ogr -f GeoJSON data/gadm2-8/CAN_1.geojson data/unzipped/CAN/CAN_adm1.shp rm ./data/gadm2-8/AUS_2.geojson ogr2ogr -f GeoJSON data/gadm2-8/AUS_2.geojson data/unzipped/AUS/AUS_adm2.shp

Run
nohup node import_admins_elasticsearch.js -d gadm2-8> nohup1.out 2>&1&
Admin meta info Unique ID:
GADM 0 features: ID_0
GADM 1 features: ID_0, ID_1.
GADM 2, also has ID_0, ID_1, ID_2.
For unique id : country_ISO-ID_0-ID_1-ID_2-admin_name.downcased
Shapefile sources:

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.