Commit 5e6b9891 authored by Christine Plumejeaud's avatar Christine Plumejeaud
Browse files

Use the records of the gazetteer, reading the portic_v6 database

parent 8cb26358
...@@ -16,7 +16,7 @@ host=localhost ...@@ -16,7 +16,7 @@ host=localhost
#134.158.33.179 #134.158.33.179
port=5432 port=5432
#port=8004 #port=8004
dbname=portic_v5 dbname=portic_v6
#user=navigo #user=navigo
...@@ -39,7 +39,8 @@ password=postgres ...@@ -39,7 +39,8 @@ password=postgres
[log] [log]
# Fichier de log pour garder une trace des opérations réalisées (il écrase le précédent si il porte le même nom) # Fichier de log pour garder une trace des opérations réalisées (il écrase le précédent si il porte le même nom)
file=C:\\Travail\\Dev\\portic_humanum\\gazetteer\\log_28oct2020.txt #file=C:\\Travail\\Dev\\portic_humanum\\gazetteer\\log_28oct2020.txt
file=/home/plumegeo/portic/log_21sept2021.txt
level=10 level=10
################################################################################################################# #################################################################################################################
...@@ -50,7 +51,7 @@ level=10 ...@@ -50,7 +51,7 @@ level=10
[proxy] [proxy]
## At ULR, you have to use proxy (True), else not (False) ## At ULR, you have to use proxy (True), else not (False)
need=True need=False
## Adresse du proxy : IP:port ## Adresse du proxy : IP:port
http_proxy=10.1.30.18:3128 http_proxy=10.1.30.18:3128
...@@ -60,4 +61,5 @@ http_proxy=10.1.30.18:3128 ...@@ -60,4 +61,5 @@ http_proxy=10.1.30.18:3128
## ##
################################################################################################################# #################################################################################################################
[outputs] [outputs]
geojson_output=C:\\Travail\\Dev\\portic_humanum\\gazetteer\\gazetteer_portic.geojson #geojson_output=C:\\Travail\\Dev\\portic_humanum\\gazetteer\\gazetteer_portic.geojson
geojson_output=/home/plumegeo/portic/gazetteer_portic.geojson
\ No newline at end of file
...@@ -36,8 +36,9 @@ CORS(app) ...@@ -36,8 +36,9 @@ CORS(app)
port = '80' port = '80'
postgresport = '5433' postgresport = '5432'
database = 'portic_v5' #postgresport = '8002'
database = 'portic_v6'
names = dict() names = dict()
names['Corse'] = 'Isles de Corse' names['Corse'] = 'Isles de Corse'
...@@ -221,6 +222,17 @@ def getPorts(): ...@@ -221,6 +222,17 @@ def getPorts():
data = retrieveDataFromPostgres(query) data = retrieveDataFromPostgres(query)
return formatOutput(data, 'ports') return formatOutput(data, 'ports')
def describeRecordedPlace (kind_of_entity, identifier) :
""" return the JSON description of the gazetter in ports.gazeetteer table.
Should be quicker than the previous methode describePlace computing dynmically the data
return a json description using the LinkedPast model
"""
query = """select linked_place_desc
from ports.gazetteer where pkid = '%s' """ %( identifier)
data = retrieveDataFromPostgres(query)
#print(data.shape)
return (data.iloc[0, 0])
def describePlace(kind_of_entity, identifier): def describePlace(kind_of_entity, identifier):
# Read the template_feature # Read the template_feature
template = os.path.join(APP_ROOT, 'template_feature.json') template = os.path.join(APP_ROOT, 'template_feature.json')
...@@ -330,7 +342,7 @@ def getPlaces(): ...@@ -330,7 +342,7 @@ def getPlaces():
#We stop here #We stop here
return '{ "No entry like this :" '+k+'}' return '{ "No entry like this :" '+k+'}'
return describePlace(kind_of_entity, k) return describeRecordedPlace(kind_of_entity, k)
......
...@@ -48,7 +48,7 @@ class RecordGaz(object): ...@@ -48,7 +48,7 @@ class RecordGaz(object):
import pandas as pd import pandas as pd
#connection = pg.connect("host='134.158.33.179' port='5433' dbname='portic_v3' user='api_user' password='portic'") #connection = pg.connect("host='134.158.33.179' port='5433' dbname='portic_v3' user='api_user' password='portic'")
#connection = pg.connect("""host='localhost' port='%s' dbname='%s' user='api_user' password='portic'"""% (postgresport, database)) #connection = pg.connect("""host='localhost' port='%s' dbname='%s' user='api_user' password='portic'"""% (postgresport, database))
connection = pg.connect("host='localhost' port='5432' dbname='portic_v5' user='postgres' password='postgres'") connection = pg.connect("host='localhost' port='5432' dbname='portic_v6' user='postgres' password='postgres'")
#ssh -N -L 8004:localhost:5433 -v navigo@134.158.33.179 #ssh -N -L 8004:localhost:5433 -v navigo@134.158.33.179
df = pd.read_sql_query(query,con=connection) df = pd.read_sql_query(query,con=connection)
...@@ -141,7 +141,7 @@ class RecordGaz(object): ...@@ -141,7 +141,7 @@ class RecordGaz(object):
output.write(desc) output.write(desc)
output.write(',') output.write(',')
query = """select uhgs_id, toponyme from ports.port_points where uhgs_id is not null""" query = """select uhgs_id, toponyme from ports.port_points where uhgs_id is not null and latitude is not null """
results = self.retrieveDataFromPostgres(query) results = self.retrieveDataFromPostgres(query)
#print(results['uhgs_id'].tolist()) #print(results['uhgs_id'].tolist())
for k in results['uhgs_id'].tolist() : for k in results['uhgs_id'].tolist() :
......
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