brew install gdal
After installing the tool, convert the SHP file to geojson first by this command
ogr2ogr -f geoJSON adrtirol.json adr_epsg4326.shp
After cleaning GEOJSON file (remove , at the end line ...)
Import file JSON to MongoDB
mongoimport --drop --host 127.0.0.1:27017 --db geodatatest --collection adrtirol < /var/mongodata/adrtirol.json
Install this tool
npm install -g geojson-rewind
geojson-rewind foo.geojson
This tool is only work with small GEOJSON file.
db.plan_overlays.renameCollection('plan_overlays_bk')
db.plan_overlays.insert(db.plan_overlays_bk.findOne())
db.plan_overlays_error.insert(db.plan_overlays_bk.findOne())
db.plan_overlays.createIndex({geometry:"2dsphere"})
db.plan_overlays.remove({})
db.plan_overlays_error.remove({})
db.plan_overlays_bk.find().forEach(function(x){
try {
db.plan_overlays.insert(x);
} catch(err) {
db.plan_overlays_error.insert(x);
}
})
db.plan_zone.find({"geometry":{$near:{$geometry: {type:"Point", coordinates:[144.9605271 , -37.8186165]}, $maxDistance:500}}})
jq -cM --argjson sublen '50' 'range(0; length; $sublen) as $i | .[$i:$i+$sublen]'
plan_ugb.json | gsplit -l 1 -da 3 - meta2_ --additional-suffix=.json