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
porticapi
Commits
0c5630a5
Commit
0c5630a5
authored
Jul 26, 2020
by
Christine Plumejeaud
Browse files
Filter port by date in order to get ports having data on the specified date (1787 by example)
parent
cec82d40
Changes
1
Hide whitespace changes
Inline
Side-by-side
porticapi/apidata.py
View file @
0c5630a5
...
...
@@ -635,11 +635,17 @@ def getPorts():
print
(
srid
)
## filter following a date
filterDate
=
'where true'
date
=
request
.
args
.
get
(
"date"
)
if
(
date
is
not
None
and
len
(
date
)
==
4
)
:
filterDate
=
""" where (substring(pointcall_out_date for 4) = '%s' or substring(pointcall_in_date for 4) = '%s') """
%
(
date
,
date
)
query
=
"""SELECT ogc_fid, uhgs_id, total, toponyme as toponym, belonging_states, belonging_substates, status, geonameid, amiraute as admiralty, province, shiparea , ST_AsGeoJSON(ST_Transform(geom, %s)) as point
FROM ports.port_points p,
(select pointcall_uhgs_id, count( *) as total
from navigoviz.pointcall gg group by pointcall_uhgs_id) as k
where p.toponyme is not null and p.uhgs_id = k.pointcall_uhgs_id"""
%
(
srid
)
from navigoviz.pointcall gg
%s
group by pointcall_uhgs_id) as k
where p.toponyme is not null and p.uhgs_id = k.pointcall_uhgs_id"""
%
(
srid
,
filterDate
)
data
=
retrieveDataFromPostgres
(
query
)
return
formatOutput
(
data
,
'ports'
)
...
...
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