@@ -238,7 +239,19 @@ Return the flows as specified in API : a list of travels linked to the specifie
- et dans la direction spécifiée (In : les arrivées et les escales précédentes, Out : les départs et les escales suivantes, In-out : uniquement les trajectoires ayant navigué en aller-retour autour des mêmes ports, No : toutes directions confondues)
### 1.2.6. /ports?
Export list of ports_points (in 900013 projection or what is specified by user) in json format,
with all required attributes for visualisations (selection of parameters is not possible for the moment)
User can get a description of the attributes by using /api/fieldnames?api=ports
Default srid is 900913
You get another by specifying a srid param
Will be extracted from postgres, schema ports, table port_points (see navigocorpus/ETL)
Tested alone : http://localhost/api/ports?srid=4326 ou http://localhost/api/ports?
and by using explorex.portic.fr application (code alphaportic for visualisation)
Test OK on 06 June 2020
"""
# select the srid given by user for geometry transformation
srid=request.args.get("srid")
#print (srid)
ifsridisNone:
srid='900913'
else:
#we chek if it is valid by looking in the postgres spatial_ref_sys table : 4326, 3857 for instance
query="""select distinct srid from public.spatial_ref_sys srs"""
srids=retrieveDataFromPostgres(query)
ifint(srid)notinsrids['srid'].tolist():
srid='900913'
print(srid)
query="""SELECT ogc_fid, uhgs_id, total, toponyme as toponym, belonging_states, 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)