Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
{
"type": "FeatureCollection",
"name": "csba",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4269" } },
"features": [
{ "type": "Feature", "properties": { "CSAFP": null, "CBSAFP": "31340", "AFFGEOID": "310M400US31340", "GEOID": "31340", "NAME": "Lynchburg, VA", "LSAD": "M1", "ALAND": 5491925729, "AWATER": 68559452 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -79.858405, 37.267155 ], [ -79.856603, 37.268712 ], [ -79.850849, 37.273676 ], [ -79.84777, 37.278472 ], [ -79.846537, 37.278741 ], [ -79.850746, 37.282415 ], [ -79.85097, 37.284316 ], [ -79.84931, 37.287642 ], [ -79.850382, 37.295107 ], [ -79.844562, 37.296109 ], [ -79.840727, 37.29816 ], [ -79.839607, 37.300414 ], [ -79.840778, 37.303043 ], [ -79.843852, 37.305416 ], [ -79.847476, 37.309352 ], [ -79.844696, 37.313029 ], [ -79.845304, 37.313877 ], [ -79.844607, 37.315177 ], [ -79.844198, 37.31775 ], [ -79.841848, 37.319109 ], [ -79.840408, 37.319365 ], [ -79.837912, 37.321669 ], [ -79.8362, 37.321925 ], [ -79.
@thomasneirynck
thomasneirynck / geojson_to_index.js
Last active November 23, 2021 08:02
Ingest geojson file into Elasticsearch index. Each feature in the FeatureCollection corresponds to a document in Elasticsearch.
const fs = require("fs");
const elasticsearch = require('elasticsearch');
const oboe = require('oboe');
const geojsonInput = process.argv[2] || 'feature_collection.geojson';
const indexname = process.argv[3] || geojsonInput.split('.')[0] || 'feature_collection';
const geometryFieldName = 'geometry';
const shape_type = process.argv[4] || 'geo_shape';
if (shape_type !== 'geo_point' && shape_type !== 'geo_shape') {