All Projects → rtbigdata → geojson-mongo-import.py

rtbigdata / geojson-mongo-import.py

Licence: MIT License
Import GeoJSON file into MongoDB using Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to geojson-mongo-import.py

Php Crud Api
Single file PHP script that adds a REST API to a SQL database
Stars: ✭ 2,904 (+14420%)
Mutual labels:  geojson, geospatial
xyz-hub
XYZ Hub is a RESTful web service for the access and management of geospatial data.
Stars: ✭ 43 (+115%)
Mutual labels:  geojson, geospatial
krawler
A minimalist (geospatial) ETL
Stars: ✭ 51 (+155%)
Mutual labels:  geojson, geospatial
Geojson2h3
Conversion utilities between H3 indexes and GeoJSON
Stars: ✭ 93 (+365%)
Mutual labels:  geojson, geospatial
geojson
GeoJSON classes for R
Stars: ✭ 32 (+60%)
Mutual labels:  geojson, geospatial
Kepler
The open source full-stack geosocial network platform
Stars: ✭ 125 (+525%)
Mutual labels:  geojson, geospatial
geojson
Library for serializing the GeoJSON vector GIS file format
Stars: ✭ 171 (+755%)
Mutual labels:  geojson, geospatial
Wellknown
WKT <-> GeoJSON
Stars: ✭ 15 (-25%)
Mutual labels:  geojson, geospatial
skynet-scrub-server
Backing store for developmentseed/skynet-scrub
Stars: ✭ 13 (-35%)
Mutual labels:  geojson, geospatial
turf-go
A Go language port of Turf.js
Stars: ✭ 41 (+105%)
Mutual labels:  geojson, geospatial
Geoswift
The Swift Geometry Engine.
Stars: ✭ 1,267 (+6235%)
Mutual labels:  geojson, geospatial
pygeoif
Basic implementation of the __geo_interface__
Stars: ✭ 44 (+120%)
Mutual labels:  geojson, geospatial
Geotools
Official GeoTools repository
Stars: ✭ 1,109 (+5445%)
Mutual labels:  geojson, geospatial
L7
🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis framework which relies on Mapbox GL or AMap to render basemaps.
Stars: ✭ 2,517 (+12485%)
Mutual labels:  geojson, geospatial
Lawn
⛔ ARCHIVED ⛔ turf.js R client
Stars: ✭ 57 (+185%)
Mutual labels:  geojson, geospatial
de9im
DE-9IM spatial predicate library implemented in Javascript.
Stars: ✭ 22 (+10%)
Mutual labels:  geojson, geospatial
Go Geom
Package geom implements efficient geometry types for geospatial applications.
Stars: ✭ 456 (+2180%)
Mutual labels:  geojson, geospatial
Magellan
Geo Spatial Data Analytics on Spark
Stars: ✭ 507 (+2435%)
Mutual labels:  geojson, geospatial
pyturf
A modular geospatial engine written in python
Stars: ✭ 15 (-25%)
Mutual labels:  geojson, geospatial
xyz-spaces-python
Manage your XYZ Hub or HERE Data Hub spaces from Python.
Stars: ✭ 29 (+45%)
Mutual labels:  geojson, geospatial

geojson-mongo-import.py

Fast GeoJSON file import into MongoDB using Python

The standard mongoimport tool provided with MongoDB does not recognize GeoJSON files without first editing them manually or running them through a script. Using this Python program instead of mongoimort takes care of that. It is assumed that the GeoJSON features will be inserted as individual documents within the target collection. The other assumption is that your import file is well-formed GeoJSON consisting of a FeatureCollection. This script should work with most standard geometry types supported in MongoDB, including Point, LineString, Polygon, along their respective multipart equivalents, such as MultiPolygon.

Before running ensure you have the PyMongo module installed:

pip install pymongo

Example usage:

python geojson-mongo-import.py -f points.geojson -d geospatial -c points

Given an input file named "points.geojson" having GeoJSON points and destination collection named "points" in the "geospatial" database. This repo includes a sample "points.geojson" file which is a FeatureCollection of points and a couple of properties including a timestamp.

Additional parameters are required if your server is not on your local machine or if your database requires authentication. Use the "--help" flag or see the example below.

python geojson-mongo-import.py -f points.geojson -s host.example.com -d mydb -c points -u user -p password

This script uses bulk write operations which results in nearly a 10x performance boost. This performance improvement is very noticeable with large GeoJSON files.

Along with importing the GeoJSON file, this script also creates a MongoDB 2dsphere geospatial index on the collection (if the named index does not exist). It also creates the named database and collection if they do not exist (and the user has permission to do so).

Script requires MongoDB 3.2 or higher (prior releases do not support bulk operations), and was developed using Python 2.7 and a MongoDB 3.4 server.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].