Commit b5570e96 authored by Christine Plumejeaud's avatar Christine Plumejeaud
Browse files

some information about difflib and dblink with geonames.

parent 69f434cc
......@@ -15,16 +15,43 @@ Clone or download this git repo, then
pip3 install -r requirements.txt
Also, the lib difflib for python with npm:
`npm install difflib`
At database level, the SGBD must have a base geonames. And you should provide a link through a materialized view with, and grant access to api_user for that.
```sql
create extension dblink;
drop view ports.myremote_geonamesplaces;
create materialized VIEW ports.myremote_geonamesplaces AS
SELECT *
FROM dblink('dbname=geonames port=5433 user=postgres password=postgres options=-csearch_path=',
'select geonameid::int, name, (feature_class||''.''||feature_code) as feature_code, alternatenames, country_code, latitude::float, longitude::float , point3857
from geonames.geonames_nov2019.allcountries a
where feature_class||''.''||feature_code in (select code from geonames.geonames_nov2019.feature_code where keep = ''x'')')
AS t1(geonameid int, name text, feature_code text, alternatenames text , country_code text, latitude float, longitude float, point3857 geometry);
--- 34 s, 5 012 322 lignes
-- 37 s, 5 012 322 lignes
grant select on ports.myremote_geonamesplaces to api_user;
grant select on ports.matching_port to api_user;
grant select on ports.limites_amirautes to api_user;
```
### 1.1.1. Running without Apache
python porticgaz.py
(or create a virtualenv, then activate it and pip install -r requirements && python apidata.py)
Backend is running and serve the data on http://localhost:5004 (change the PORT variable in config.py)
Backend is running and serve the data on http://localhost:80 (change the PORT variable at the top level of porticgaz.py)
### 1.1.2. Running with Apache
The gazetteer is served by Apache2 running WSGI module.
```bash
cd /home/plumegeo/navigo/Viz/gazetteer
......@@ -116,8 +143,9 @@ You can go on http://explorex.portic.fr to find the UHGS id of a port present in
### 1.2.4. fielnames
Récupère des métadonnées sur l'API, avec la liste des attributs, avec leur nom court et long, leur type et leur signification.
get metadata about the gazetteer with short and long name, type and definition
Api 'ports' by default.
Get metadata about the gazetteer with short and long name, type and definition
Api is 'ports' by default.
http://127.0.0.1:80/fieldnames/?format=json
http://127.0.0.1/fieldnames/?format=json&shortenfields=true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment