This chapter shows examples of importing geospatial data from external sources into MongoDB collections.
Because external sources provide their files in various formats, in many cases it is necessary to use GDAL (Geospatial Data Abstraction Library), which is a translator library for raster and vector geospatial data formats released under an X/MIT style Open Source license by the Open Source Geospatial Foundation, to convert the data to GeoJSON format before being imported into MongoDB.
Commands used to install GDAL on Ubuntu:
$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:ubuntugis/ppa $ sudo apt-get update $ sudo apt-get install gdal-bin
To test the installation the following command was executed:
$ ogr2ogr --long-usage
- “UbuntuGIS” team
- Debian GIS
- GDAL - Geospatial Data Abstraction Library
- Installing GDAL/OGR on Ubuntu