Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Portic
gazetteer
Commits
5e6b9891
Commit
5e6b9891
authored
Sep 21, 2021
by
Christine Plumejeaud
Browse files
Use the records of the gazetteer, reading the portic_v6 database
parent
8cb26358
Changes
3
Show whitespace changes
Inline
Side-by-side
config.txt
View file @
5e6b9891
...
...
@@ -16,7 +16,7 @@ host=localhost
#134.158.33.179
port=5432
#port=8004
dbname=portic_v
5
dbname=portic_v
6
#user=navigo
...
...
@@ -39,7 +39,8 @@ password=postgres
[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)
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
#################################################################################################################
...
...
@@ -50,7 +51,7 @@ level=10
[proxy]
## At ULR, you have to use proxy (True), else not (False)
need=
Tru
e
need=
Fals
e
## Adresse du proxy : IP:port
http_proxy=10.1.30.18:3128
...
...
@@ -60,4 +61,5 @@ http_proxy=10.1.30.18:3128
##
#################################################################################################################
[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
porticgaz.py
View file @
5e6b9891
...
...
@@ -36,8 +36,9 @@ CORS(app)
port
=
'80'
postgresport
=
'5433'
database
=
'portic_v5'
postgresport
=
'5432'
#postgresport = '8002'
database
=
'portic_v6'
names
=
dict
()
names
[
'Corse'
]
=
'Isles de Corse'
...
...
@@ -221,6 +222,17 @@ def getPorts():
data
=
retrieveDataFromPostgres
(
query
)
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
):
# Read the template_feature
template
=
os
.
path
.
join
(
APP_ROOT
,
'template_feature.json'
)
...
...
@@ -330,7 +342,7 @@ def getPlaces():
#We stop here
return
'{ "No entry like this :" '
+
k
+
'}'
return
describePlace
(
kind_of_entity
,
k
)
return
describe
Recorded
Place
(
kind_of_entity
,
k
)
...
...
recordgaz.py
View file @
5e6b9891
...
...
@@ -48,7 +48,7 @@ class RecordGaz(object):
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='localhost' port='%s' dbname='%s' user='api_user' password='portic'"""% (postgresport, database))
connection
=
pg
.
connect
(
"host='localhost' port='5432' dbname='portic_v
5
' user='postgres' password='postgres'"
)
connection
=
pg
.
connect
(
"host='localhost' port='5432' dbname='portic_v
6
' user='postgres' password='postgres'"
)
#ssh -N -L 8004:localhost:5433 -v navigo@134.158.33.179
df
=
pd
.
read_sql_query
(
query
,
con
=
connection
)
...
...
@@ -141,7 +141,7 @@ class RecordGaz(object):
output
.
write
(
desc
)
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
)
#print(results['uhgs_id'].tolist())
for
k
in
results
[
'uhgs_id'
].
tolist
()
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment