ExamplesEvents
Get encounter events statistics filtered by flag and duration (POST)
Example events statistics request for carrier-fishing encounters, filtered by vessel type and date range.
Request body
| Field | Value | Description |
|---|---|---|
datasets | ["public-global-encounters-events:latest"] | Encounter events dataset |
encounterTypes | ["CARRIER-FISHING", "FISHING-CARRIER"] | Encounter types to include |
vesselTypes | ["CARRIER"] | Vessel types to include |
startDate | 2018-01-01 | Start of the date range |
endDate | 2023-01-31 | End of the date range |
timeseriesInterval | YEAR | Timeseries aggregation interval |
flags | ["RUS"] | Filter by vessel flag |
duration | 60 | Minimum event duration in minutes |
Request
# Make sure to replace [TOKEN] with your API Access Token.
curl --location --request POST 'https://gateway.api.globalfishingwatch.org/v3/events/stats' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access-token}'
--header 'Content-Type: application/json' \
--data-raw '{
"datasets": [ "public-global-encounters-events:latest"],
"encounterTypes": ["CARRIER-FISHING", "FISHING-CARRIER"],
"vesselTypes": ["CARRIER"],
"startDate": "2018-01-01",
"endDate": "2023-01-31",
"timeseriesInterval": "YEAR",
"flags": ["RUS"],
"duration": 60
}
'result = await gfw_client.events.get_events_stats(
datasets=["public-global-encounters-events:latest"],
timeseries_interval="YEAR",
start_date="2018-01-01",
end_date="2023-01-31",
encounter_types=["CARRIER-FISHING", "FISHING-CARRIER"],
vessel_types=["CARRIER"],
flags=["RUS"],
duration=60,
)gfw_event_stats(event_type = "ENCOUNTER",
start_date = "2018-01-01",
end_date = "2023-01-31",
interval = "YEAR",
encounter_types = c("CARRIER-FISHING", "FISHING-CARRIER"),
vessel_types = "CARRIER",
flags = "RUS",
duration = 60)// Make sure to replace [TOKEN] with your API Access Token.
const res = await fetch('https://gateway.api.globalfishingwatch.org/v3/events/stats', {
method: 'POST',
headers: {
Authorization: 'Bearer [TOKEN]',
'Content-Type': 'application/json',
},
body: JSON.stringify({
datasets: ['public-global-encounters-events:latest'],
encounterTypes: ['CARRIER-FISHING', 'FISHING-CARRIER'],
vesselTypes: ['CARRIER'],
startDate: '2018-01-01',
endDate: '2023-01-31',
timeseriesInterval: 'YEAR',
flags: ['RUS'],
duration: 60,
}),
})
const data = await res.json()Response
{
"numEvents": 23300,
"numFlags": 1,
"numVessels": 202,
"flags": ["RUS"],
"timeseries": [
{
"date": "2018-01-01T00:00:00.000Z",
"value": 4486
},
{
"date": "2019-01-01T00:00:00.000Z",
"value": 4234
},
{
"date": "2020-01-01T00:00:00.000Z",
"value": 4656
},
{
"date": "2021-01-01T00:00:00.000Z",
"value": 4807
},
{
"date": "2022-01-01T00:00:00.000Z",
"value": 4701
},
{
"date": "2023-01-01T00:00:00.000Z",
"value": 416
}
]
}