-
Notifications
You must be signed in to change notification settings - Fork 1
Client API
The Tsu-DAT 2 django server application exposes the following set of api endpoints for use by the GeoExt client application to drive the user interface.
^tsudat/ ^return_periods/$
^tsudat/ ^return_period/$
^tsudat/ ^hazard_points/$
^tsudat/ ^source_zones/$
^tsudat/ ^source_zone/$
^tsudat/ ^sub_faults/$
^tsudat/ ^events/$
^tsudat/ ^wave_height/$
^tsudat/ ^project/$
^tsudat/ ^project/(?P<id>[0-9]+)/$
^tsudat/ ^polygon_from_csv/$
^tsudat/ ^internal_polygon_types/$
^tsudat/ ^internal_polygon/$
^tsudat/ ^internal_polygon/(?P<id>[0-9]+)/$
^tsudat/ ^gauge_point/$
^tsudat/ ^gauge_point/(?P<id>[0-9]+)/$
^tsudat/ ^scenario/$
^tsudat/ ^scenario/(?P<id>[0-9]+)/$
^tsudat/ ^layer/$
^tsudat/ ^layer/(?P<uuid>[\w]{8}(-[\w]{4}){3}-[\w]{12})/$
^tsudat/ ^data_set/$
^tsudat/ ^data_set/(?P<id>[0-9]+)/$
^tsudat/ ^project_data_set/$
^tsudat/ ^project_data_set/(?P<id>[0-9]+)/$
^tsudat/ ^run_scenario/(?P<scenario_id>[0-9]+)/$
Returns the complete set of Return Periods
Input Variables
- None
http://tsudat.dev.opengeo.org/tsudat/return_periods/
[
[
10,
"10 years"
],
....
[
100000,
"100000 years"
]
]
Returns the return period that most closely matches the input Hazard Point and Wave Height range
Input Variables
- hp = Hazard Point Tsu-DAT ID
- wh = Wave Height median
- whd = Wave Height Delta (+/-)
http://tsudat.dev.opengeo.org/tsudat/return_period/?hp=2037&wh=1&whd=0.5
[
{
"pk": 11855,
"model": "tsudat.hazardpointdetail",
"fields": {
"return_period": 25000
}
}
]
Returns the complete list of Hazard Points (~883 for Australia). If return period input variables are specified, the returned json will include the wave height for each point as well as the color that should be used for rendering. Its not yet clear whether the coloring should be done with SLD or via OpenLayers Styles.
Input Variables
- rp = Return Period (numeric value, see return_period endpoint above)
http://tsudat.dev.opengeo.org/tsudat/hazard_points/
{
"crs": null,
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
144.7,
-9.383
]
},
"type": "Feature",
"id": 1,
"properties": {
"tsudat_id": 2037
}
},
{
"geometry": {
"type": "Point",
"coordinates": [
144.633,
-9.5
]
},
}
]
}
TODO: Add sample endpoint/output when rp is specifed.
Return all source zones.
NOTE: The model/database is designed to store a linestring for each source zone, but they are not currently populated or exposed via the endpoint. It is desirable in the future to include/expose these and render them.
http://tsudat.dev.opengeo.org/tsudat/source_zones/
[
{
"pk": 1,
"model": "tsudat.sourcezone",
"fields": {
"tsudat_id": 0,
"name": "Alaska"
}
},
{
"pk": 2,
"model": "tsudat.sourcezone",
"fields": {
"tsudat_id": 34,
"name": "Aleutians"
}
},
{
"pk": 3,
"model": "tsudat.sourcezone",
"fields": {
"tsudat_id": 100,
"name": "Altiplano"
}
},
{
"pk": 4,
"model": "tsudat.sourcezone",
"fields": {
"tsudat_id": 124,
"name": "Andaman"
}
},
{
"pk": 5,
"model": "tsudat.sourcezone",
"fields": {
"tsudat_id": 176,
"name": "Arakan"
}
},
{
"pk": 6,
"model": "tsudat.sourcezone",
"fields": {
"tsudat_id": 212,
"name": "Cascadia"
}
}
]
Return the source zone for a specific sub-fault
Input Variables
- sf = sub fault ID
http://tsudat.dev.opengeo.org/tsudat/source_zone/?sf=32
[
{
"pk": 1,
"model": "tsudat.sourcezone",
"fields": {
"geom": null,
"tsudat_id": 0,
"name": "Alaska"
}
}
]
Return all sub-faults ... or only those for a specific source zone
Input Variables:
- sz = source zone tsudat id
http://tsudat.dev.opengeo.org/tsudat/sub_faults/
http://tsudat.dev.opengeo.org/tsudat/sub_faults/?sz=4
{
"crs": null,
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
207.2351,
56.0541
]
},
"type": "Feature",
"id": 1,
"properties": {
"strike": null,
"dip": null,
"tsudat_id": 0
}
},
{
"geometry": {
"type": "Point",
"coordinates": [
206.7657,
56.4066
]
},
"type": "Feature",
"id": 2,
"properties": {
"strike": null,
"dip": null,
"tsudat_id": 1
}
},
{
"geometry": {
"type": "Point",
"coordinates": [
206.2876,
56.7573
]
},
"type": "Feature",
"id": 3,
"properties": {
"strike": null,
"dip": null,
"tsudat_id": 2
}
}
]
}
Returns the list of events that are valid for the specified set of input parameters.
Input Variables
- hp = Hazard Point Tsu-DAT ID
- wh = Wave Height
- whd = Wave Height Delta (+/-)
- sz = Source Zone
http://tsudat.dev.opengeo.org/tsudat/events/?hp=1706&wh=0.5&whd=0.05&sz=1082
[
{
"pk": 12278079,
"model": "tsudat.eventwaveheight",
"fields": {
"wave_height": 0.472506,
"event": 68849,
"hazard_point": 750
}
},
{
"pk": 12278081,
"model": "tsudat.eventwaveheight",
"fields": {
"wave_height": 0.489386,
"event": 68851,
"hazard_point": 750
}
}
]
Returns the single wave height that is valid for the specified input parameters.
- rp = Return Period specified as the actual value in years
- hp = Hazard Point specified as the tsudat id
http://tsudat.dev.opengeo.org/tsudat/wave_height/?rp=100&hp=2029
[
{
"pk": 11665,
"model": "tsudat.hazardpointdetail",
"fields": {
"wave_height": 0.076694,
"color": "#03ff00",
"return_period": 100,
"hazard_point": 4
}
}
]
Returns either all projects or a single project as GeoJSON vi a GET -or- creates a new project via POST -or- updates an existing project via PUT -or- deletes an existing project via DELETE
Will require authentication to be implemented.
curl -i -X POST -d @data/project.json http://tsudat.dev.opengeo.org/tsudat/project/
project.json
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
15.996093747134692,
11.523087504832255
],
[
21.181640621206277,
6.489983331513099
],
[
9.316406248331194,
-4.214943140637002
],
[
-15.205078122276833,
-4.828259746004159
],
[
-5.449218749023906,
6.053161294633828
],
[
15.996093747134692,
11.523087504832255
]
]
]
},
"type": "Feature",
"properties": {
"name": "test 8"
}
}
curl -i -X PUT -d @data/test.json http://tsudat.dev.opengeo.org/tsudat/project/49/
{"status": "success", "msg": "Project Update Successful", "id": 49}
curl -i -X DELETE http://tsudat.dev.opengeo.org/tsudat/project/49/
{"status": "success", "msg": "project deleted"}
Accepts a csv file with coordinate pairs and returns a GeoJSON formatted polygon.
NOTE: The srs parameter is optional. If it is not specified, EPSG:4326 (unprojected) is assumed. It can be specified as any one of OGC WKT, EPSG Code as integer or string, Proj.4 string or shorthand string for common projections. (see http://docs.djangoproject.com/en/dev/ref/contrib/gis/gdal/#django.contrib.gis.gdal.SpatialReference)
curl -i -X POST -F "csv_file=@data/area_of_interest.csv" -F "srs=EPSG:32618" http://tsudat.dev.opengeo.org/tsudat/polygon_from_csv/
area_of_interest.csv
https://github.com/AIFDR/tsudat2/blob/master/data/area_of_interest.csv
255206.7164,6045248.991
252142.5136,6041532.83
249339.094,6036317.165
245231.7583,6039707.347
240472.4646,6041337.242
239690.115,6044401.445
241841.5765,6048834.76
247122.4367,6050399.459
250773.4017,6050529.851
Returns
{
"type": "Polygon",
"coordinates": [
[
[
-78.780410,
54.495654
],
[
-78.824500,
54.460844
],
[
-78.863239,
54.412701
],
[
-78.929290,
54.441059
],
[
-79.003924,
54.453265
],
[
-79.018656,
54.480335
],
[
-78.989407,
54.521180
],
[
-78.909355,
54.537871
],
[
-78.853166,
54.540849
],
[
-78.780410,
54.495654
]
]
]
}
Returns the list of valid internal polygon types.
http://tsudat.dev.opengeo.org/tsudat/internal_polygon_types/
[
[
1,
"Mesh Resolution"
],
[
2,
"Mesh Friction"
],
[
3,
"Area of Interest"
],
[
4,
"Area of Significance"
]
]
- http://tsudat.dev.opengeo.org/tsudat/internal_polygon/
- http://tsudat.dev.opengeo.org/tsudat/internal_polygon/2/
GET by project_id and type TODO
Will require authentication to be implemented.
curl -i -X POST -d @data/area_of_interest.json http://tsudat.dev.opengeo.org/tsudat/internal_polygon/
curl -i -X POST -d @data/area_of_significance.json http://tsudat.dev.opengeo.org/tsudat/internal_polygon/
https://github.com/AIFDR/tsudat2/blob/master/data/area_of_interest.json
{
"geometry": {
"crs": {
"type": "name",
"properties": {
"name": "EPSG:28356"
}
},
"type": "Polygon",
"coordinates": [
[
[
255206.7164,
6045248.991
],
[
252142.5136,
6041532.83
],
[
249339.094,
6036317.165
],
[
245231.7583,
6039707.347
],
[
240472.4646,
6041337.242
],
[
239690.115,
6044401.445
],
[
241841.5765,
6048834.76
],
[
247122.4367,
6050399.459
],
[
250773.4017,
6050529.851
],
[
255206.7164,
6045248.991
]
]
]
},
"type": "Feature",
"properties": {
"name": "test",
"project_id": "34",
"type": "3",
"value": "500.0"
}
}
https://github.com/AIFDR/tsudat2/blob/master/data/area_of_significance.json
{
"geometry": {
"crs": {
"type": "name",
"properties": {
"name": "EPSG:28356"
}
},
"type": "Polygon",
"coordinates": [
[
[
258531.7025,
6048182.802
],
[
255858.6745,
6043488.704
],
[
250838.5975,
6033057.375
],
[
247969.9821,
6033774.529
],
[
243275.8842,
6037490.69
],
[
239298.9401,
6040294.109
],
[
238777.3737,
6044792.62
],
[
240537.6604,
6050138.676
],
[
245948.9122,
6051116.613
],
[
251881.7304,
6052355.333
],
[
255308.3406,
6050401.856
],
[
256836.6115,
6049030.347
],
[
258531.7025,
6048182.802
]
]
]
},
"type": "Feature",
"properties": {
"name": "test",
"project_id": "34",
"type": "4",
"value": "2500.0"
}
}
curl -i -X PUT -d @data/area_of_interest.json http://tsudat.dev.opengeo.org/tsudat/internal_polygon/1/
{"status": "success", "msg": "Internal Polygon Update Successful", "id": 1}
curl -i -X DELETE http://tsudat.dev.opengeo.org/tsudat/internal_polygon/1/
{"status": "success", "msg": "internal polygon deleted"}
http://tsudat.dev.opengeo.org/tsudat/gauge_point/
http://tsudat.dev.opengeo.org/tsudat/gauge_point/1/
GET by project_id and params TODO
Will require authentication to be implemented.
curl -i -X POST -d @data/gauge_point.json http://tsudat.dev.opengeo.org/tsudat/gauge_point/
https://github.com/AIFDR/tsudat2/blob/master/data/gauge_point.json
{
"geometry": {
"type": "Point",
"coordinates": [
150.25794980218066,
-35.74929864581691
]
},
"type": "Feature",
"properties": {
"project_id": "34",
"name": "Tollgate Islands"
}
}
curl -i -X PUT -d @data/gauge_point.json http://tsudat.dev.opengeo.org/tsudat/gauge_point/1/
{"status": "failure", "msg": "Gauge Point Update Successful", "id": 3}
curl -i -X DELETE http://tsudat.dev.opengeo.org/tsudat/gauge_point/3/
{"status": "success", "msg": "gauge point deleted"}
http://tsudat.dev.opengeo.org/tsudat/scenario/
http://tsudat.dev.opengeo.org/tsudat/scenario/1/
GET by project_id and params TODO
Will require authentication to be implemented.
curl -i -X POST -d @data/scenario.json http://tsudat.dev.opengeo.org/tsudat/scenario/
https://github.com/AIFDR/tsudat2/blob/master/data/scenario.json
{
"model": "tsudat.scenario",
"fields": {
"name": "Test Scenario",
"model_setup": "T",
"hazard_point": 852,
"start_time": 0,
"source_zone": 24,
"wave_height_delta": 1,
"project": 45,
"smoothing_param": 1.0,
"end_time": 100000,
"wave_height": 1.5,
"initial_tidal_stage": 1.0,
"return_period": 1000,
"default_friction_value": 1.0,
"event": 76471,
"output_layers": [
"shear",
"energy",
"velocity"
],
"raster_resolution": 10000,
"output_max": true,
"use_aoi": false
}
}
curl -i -X PUT -d @data/scenario.json http://tsudat.dev.opengeo.org/tsudat/scenario/1/
{"status": "success", "msg": "Scenario Update Successful", "id": "1"}
curl -i -X DELETE http://tsudat.dev.opengeo.org/tsudat/scenario/1/
{"status": "success", "msg": "scenario deleted"}
Returns GeoNode Layer objects which are coverages directly from the GeoNode database. Queryable by project_id using project boundary polygon or by single uuid.
http://tsudat.dev.opengeo.org/tsudat/layer/ (Returns all coverage layers in GeoNode)
http://tsudat.dev.opengeo.org/tsudat/layer/?project_id=3 (Returns set intersecting project boundary)
http://tsudat.dev.opengeo.org/tsudat/layer/28a7593d-7ad5-4ec7-932d-f5c5a3389378/ (returns single layer inside set)
{
"pk": 14,
"model": "maps.layer",
"fields": {
"constraints_other": null,
"date_type": "('creation', u'Creation')",
"geographic_bounding_box": "SRID=EPSG:4326;POLYGON((140.0 -60.0,140.0 -10.0,180.0 -10.0,180.0 -60.0,140.0 -60.0))",
"edition": null,
"keywords": "",
"distribution_url": "http://tsudat.geonode.opengeo.org/data/gtopo:E140S10",
"spatial_representation_type": null,
"uuid": "28a7593d-7ad5-4ec7-932d-f5c5a3389378",
"title": "E140S10",
"owner": null,
"storeType": "coverageStore",
"abstract": "Generated from Gtopo30",
"store": "gtopo30_E140S10",
"distribution_description": "Online link to the 'E140S10' description on GeoNode",
"topic_category": "location",
"purpose": null,
"date": "2011-02-17 22:29:51",
"temporal_extent_end": null,
"name": "E140S10",
"language": "eng",
"keywords_region": "USA",
"maintenance_frequency": null,
"supplemental_information": "You can customize the template to suit your needs. You can add and remove fields and fill out default information (e.g. contact details). Fields you can not change in the default view may be accessible in the more comprehensive (and more complex) advanced view. You can even use the XML editor to create custom structures, but they have to be validated by the system, so know what you do :-)",
"typename": "gtopo:E140S10",
"workspace": "gtopo",
"data_quality_statement": null,
"temporal_extent_start": null,
"constraints_use": "copyright"
}
}
Returns DataSet objects from tsudat database which is an index of GeoNode coverage layers with coverage geometry converted to polygon, spatial resolution in meters defined and DEM type defined.
http://tsudat.dev.opengeo.org/tsudat/data_set/ - Reindex from GeoNode and return full set of coverages
http://tsudat.dev.opengeo.org/tsudat/data_set/?project_id=3 - Get only DataSet objects that intersect the project boundary polygon)
http://tsudat.dev.opengeo.org/tsudat/data_set/8/ - Get single DataSet object in a set
[
{
"pk": 8,
"model": "tsudat.dataset",
"fields": {
"geom": "POLYGON ((150.1199389437226444 -35.7824692929434391, 150.1245405905702341 -35.6545988062593651, 150.2955760177686386 -35.6585641752060667, 150.2912472404276798 -35.7864532646124189, 150.1199389437226444 -35.7824692929434391))",
"resolution": 0,
"data_type": "U",
"geonode_layer_uuid": "18029a71-511b-4c3d-a4ab-a85dc0cca0d3"
}
}
]
http://tsudat.dev.opengeo.org/tsudat/project_data_set/ - Return all ProjectDataSet objects
http://tsudat.dev.opengeo.org/tsudat/project_data_set/?project_id=3 - Return all ProjectDataSet objects for the specified project_id
http://tsudat.dev.opengeo.org/tsudat/project_data_set/8/ - Return a single ProjectDataSet object in a set
[
{
"pk": 8,
"model": "tsudat.projectdataset",
"fields": {
"project": 3,
"ranking": 0,
"dataset": 10
}
}
]
Will require authentication to be implemented.
curl -i -X POST -d @data/project_data_set.json http://tsudat.dev.opengeo.org/tsudat/project_data_set/
https://github.com/AIFDR/tsudat2/blob/master/data/project_data_set.json
{
"model": "tsudat.projectdataset",
"fields": {
"project": 3,
"ranking": 0,
"dataset": 1
}
}
curl -i -X PUT -d @data/project_data_set.json http://tsudat.dev.opengeo.org/tsudat/project_data_set/15/
{"status": "success", "msg": "Project Dataset Update Successful", "id": "15"}
curl -i -X DELETE http://tsudat.dev.opengeo.org/tsudat/project_data_set/15/
{"status": "success", "msg": "project deleted"}
Queues a scenario for processing.
http://tsudat.dev.opengeo.org/tsudat/run_scenario/1/
If the entire project and scenario are successfully validated, the scenario will be queued for processing, and the return value will look like the following. TODO: Include the ID of the queued scenario for reference.
{'status': 'success', 'msg': 'Scenario queued for processing'}
-or-
If the project and scenario are not validated successfully, the return value will look like the following, and will contain a description of why it was deemed invalid. The user should be given the opportunity to fix the errors and resubmit.
{'status': 'failure', 'msg': 'Failed queuing Scenario for processing', 'reason': 'Some description here'}
- 400 (Bad Request)
- 401 (Unauthorized)
- 403 (Forbidden)
- 404 (Not Found)
- 405 (Method Not Allowed)
- 500 (Internal Server Error)