Commit 0c5630a5 authored by Christine Plumejeaud's avatar Christine Plumejeaud
Browse files

Filter port by date in order to get ports having data on the specified date (1787 by example)

parent cec82d40
......@@ -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')
......
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