From 2afd9d470364bfe542928cde114ef66c79bbe685 Mon Sep 17 00:00:00 2001
From: Duchateau Fabien <fabien.duchateau@univ-lyon1.fr>
Date: Fri, 25 Jan 2019 12:37:22 +0100
Subject: [PATCH] maj README et config files

---
 README.md            | 28 ++++++++++++++++++++++++++--
 mongiris/mongiris.py |  2 +-
 setup.cfg            |  1 -
 setup.py             | 13 ++++++++-----
 4 files changed, 35 insertions(+), 9 deletions(-)
 mode change 100644 => 100755 mongiris/mongiris.py

diff --git a/README.md b/README.md
index 5ec465a..b018fdb 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 9556627..3d2eed1
--- 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 9f096d1..9b29859 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 3f7aa16..39c246a 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
+""")
+
-- 
GitLab