diff --git a/README.md b/README.md index 5ec465ab2e81b09d0c040800a9a0f4d0f06b3981..b018fdb84d94cae43cf0bfb2c9f3b7c627c3d319 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,29 @@ # mongiris package -This package is an interface for querying INSEE IRIS stored as documents in MongoDB. -Requires loading the IRIS files into MongoDB prior to using this package. +This package is an interface for querying IRIS stored as documents in MongoDB. + +[IRIS](https://www.insee.fr/fr/metadonnees/definition/c1523) are French administrative areas (similar to neighbordhoods). The ~50,000 IRIS for France are stored in the GeoJSON format. + +## Pré-requis + +- Python, version >=3 +- [MongoDB](https://www.mongodb.com/), version >=4, in which it is necessary to import the IRIS database (see Installation). + +## Installation + +To install mongiris: + +``` +python3 -m pip install git+https://fduchate@gitlab.liris.cnrs.fr/fduchate/mongiris.git#egg=mongiris +``` + + +Next, you need to load the IRIS data into MongoDB (using the `mongorestore` tool): + +``` +./mongorestore --archive=/path/to/dump-iris.bin +``` + +where `/path/to/` indicates the path to the dump IRIS database (provided with the source package mongiris in `mongiris/data/dump-iris.bin`) + diff --git a/mongiris/mongiris.py b/mongiris/mongiris.py old mode 100644 new mode 100755 index 95566275302c5dfa8a6725969353cf33b41b0134..3d2eed17953dbb1e55eaaeff98cc6b6e5a718aa5 --- a/mongiris/mongiris.py +++ b/mongiris/mongiris.py @@ -86,7 +86,7 @@ class Mongiris: except Exception as e: self.logger.error('Error with MongoDB connection: ' + str(e)) #TODO delete next line (which removes one IRIS in Gravelines). Its GeoJSON is valid, but it has 2 edges (very close) - #TODO that cross according to MOngoDB (and GDAL), which avoid the creation of an index. See file iris_errno.geojson + #TODO that cross according to MOngoDB (and GDAL), which prevents the creation of an index. See file iris_errno.geojson #TODO CODE_IRIS = 592730103 self.iris_collection.delete_one({"properties.CODE_IRIS": 592730103}) # should not be found, but just in case nb_docs = self.count_documents(self.iris_collection, {}) diff --git a/setup.cfg b/setup.cfg index 9f096d183fec724b1da46ff77c597d02e0e6275f..9b2985974d2a94a49c528aa9b71e5890e177cd5c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,3 @@ -# mongiris setup.cfg [metadata] name = mongiris diff --git a/setup.py b/setup.py index 3f7aa16f92f24437d0438296c940fd8740845ed9..39c246a98683a1830c9d3670c6b7c57e4ff60cf9 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,6 @@ # python3 -m setup bdist_wheel sdist -# python3 -m pip install -e ../mongiris/ - +# python3 -m pip install -e mongiris/ # python3 -m pip install git+https://fduchate@gitlab.liris.cnrs.fr/fduchate/mongiris.git#egg=mongiris -# collecte et installe le projet mongiris -> à mettre dans vizliris du coup ! #!/usr/bin/env python # mongiris setup.py (uses setup.cfg) @@ -15,10 +13,15 @@ if sys.argv[-1] == "publish": os.system("python setup.py bdist_wheel upload --sign") sys.exit() - readme = open("README.md").read() #history = open("HISTORY.rst").read().replace(".. :changelog:", "") - setup(long_description=readme) # + "\n\n" + history) +print("""Mongiris has been installed. + +Do not forget to load the IRIS collection into MongoDB: + +\t\tmongorestore --archive=/path/to/dump-iris.bin +""") +