I have the school district shapefiles from TIGER for Michigan, from: ftp://ftp2.census.gov/geo/tiger/TIGER2012/UNSD/

I'd like to use MongoDBs geoquery features to interrogate this data.

How do I upload the .sh, .sh.xml, .dbf, .prj files into MongoDB so that I can execute these queries?


I don't think you want to store your ESRI Shapefiles in MongoDB. There are only two ways to store your data in MongoDB so that you might operate over them using the provided geospatial indices and queries: as GeoJSON Point, Line, or Polygon features, or as "legacy coordinate pairs." You probably want to store the same geographic features as a GeoJSON document. You can easily convert your Shapefiles to GeoJSON using GDAL's ogr2ogr:

ogr2ogr -f "GeoJSON" output_features.json input_features.shp

Next, you'll need to use MongoDB's API to insert these documents into a collection. There's a great number of client libraries to choose from for this purpose. Document insertion using any one of these APIs is very straightforward; here's an example from the Python API documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.