ExamplesEvents
Get port visit events with a custom polygon and duration filter (POST)
Example POST request for port visit events inside a custom GeoJSON polygon, filtered by event duration.
Query parameters
| Parameter | Value | Description |
|---|---|---|
offset | 0 | Pagination offset |
limit | 1 | Max number of events returned |
Request body
| Field | Value | Description |
|---|---|---|
datasets | ["public-global-port-visits-events:latest"] | Port visits events dataset |
startDate | 2017-01-01 | Start of the date range |
endDate | 2017-01-31 | End of the date range |
vessels | ["e0248aed9-99b4-bae7-6b87-ff0a3c464676"] | Vessel id to filter events for |
flags | ["ATG"] | Filter by vessel flag |
duration | 60 | Minimum event duration in minutes |
geometry | custom Polygon | Custom region to filter events in |
Request
# Make sure to replace [TOKEN] with your API Access Token.
curl --location --request POST 'https://gateway.api.globalfishingwatch.org/v3/events?offset=0&limit=1' \
--header 'Authorization: Bearer [TOKEN]' \
--header 'Content-Type: application/json' \
--data-raw '{
"datasets": [ "public-global-port-visits-events:latest"],
"startDate": "2017-01-01",
"endDate": "2017-01-31",
"vessels": ["e0248aed9-99b4-bae7-6b87-ff0a3c464676"],
"flags": ["ATG"],
"duration": 60,
"geometry":{
"type": "Polygon",
"coordinates": [
[
[
30.552978515625,
46.255846818480315
],
[
31.22314453125,
46.255846818480315
],
[
31.22314453125,
46.59661864884465
],
[
30.552978515625,
46.59661864884465
],
[
30.552978515625,
46.255846818480315
]
]
]
}
}'result = await gfw_client.events.get_all_events(
datasets=["public-global-port-visits-events:latest"],
start_date="2017-01-01",
end_date="2017-01-31",
vessels=["e0248aed9-99b4-bae7-6b87-ff0a3c464676"],
flags=["ATG"],
duration=60,
geometry={
"type": "Polygon",
"coordinates": [
[
[30.552978515625, 46.255846818480315],
[31.22314453125, 46.255846818480315],
[31.22314453125, 46.59661864884465],
[30.552978515625, 46.59661864884465],
[30.552978515625, 46.255846818480315],
]
],
},
)// Make sure to replace [TOKEN] with your API Access Token.
const res = await fetch('https://gateway.api.globalfishingwatch.org/v3/events?offset=0&limit=1', {
method: 'POST',
headers: {
Authorization: 'Bearer [TOKEN]',
'Content-Type': 'application/json',
},
body: JSON.stringify({
datasets: ['public-global-port-visits-events:latest'],
startDate: '2017-01-01',
endDate: '2017-01-31',
vessels: ['e0248aed9-99b4-bae7-6b87-ff0a3c464676'],
flags: ['ATG'],
duration: 60,
geometry: {
type: 'Polygon',
coordinates: [
[
[30.552978515625, 46.255846818480315],
[31.22314453125, 46.255846818480315],
[31.22314453125, 46.59661864884465],
[30.552978515625, 46.59661864884465],
[30.552978515625, 46.255846818480315],
],
],
},
}),
})
const data = await res.json()Response
{
"metadata": {
"datasets": ["public-global-port-visits-events:v3.0"],
"vessels": ["e0248aed9-99b4-bae7-6b87-ff0a3c464676"],
"dateRange": {
"from": "2017-01-01",
"to": "2017-01-31"
},
"encounterTypes": [],
"flags": ["ATG"],
"geometry": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[30.552978515625, 46.255846818480315],
[31.22314453125, 46.255846818480315],
[31.22314453125, 46.59661864884465],
[30.552978515625, 46.59661864884465],
[30.552978515625, 46.255846818480315]
]
]
}
}
]
}
},
"limit": 1,
"offset": 0,
"nextOffset": 1,
"total": 1,
"entries": [
{
"start": "2017-01-01T00:00:00.000Z",
"end": "2017-01-01T09:35:02.000Z",
"id": "4f76e3bf40fcb9af92f6e7250154c86d",
"type": "port_visit",
"position": {
"lat": 46.3181,
"lon": 31.0484
},
"regions": {
"mpa": [],
"eez": ["5695"],
"rfmo": ["IWC", "ICCAT", "GFCM", "ACAP"],
"fao": ["37", "37.4.2", "37.4"],
"majorFao": ["37"],
"eez12Nm": [],
"highSeas": [],
"mpaNoTakePartial": [],
"mpaNoTake": []
},
"boundingBox": [31.0767735168, 46.2917746863, 31.0090529428, 46.3757554864],
"distances": {
"startDistanceFromShoreKm": 28,
"endDistanceFromShoreKm": 20,
"startDistanceFromPortKm": 0,
"endDistanceFromPortKm": 0
},
"vessel": {
"id": "e0248aed9-99b4-bae7-6b87-ff0a3c464676",
"name": "ONEGOOTRA",
"ssvid": "305656000"
},
"port_visit": {
"visitId": "ffe81fe2608c6de1799a701b736951ca",
"confidence": 4,
"durationHrs": 9.58388888888889,
"startAnchorage": {
"anchorageId": "40c652c5",
"atDock": false,
"distanceFromShoreKm": 28,
"flag": "UKR",
"id": "ukr-mykolayiv",
"lat": 46.291774686340844,
"lon": 31.076773516760372,
"name": null,
"topDestination": "NIKOLAEV"
},
"intermediateAnchorage": {
"anchorageId": "40c65295",
"atDock": false,
"distanceFromShoreKm": 26,
"flag": "UKR",
"id": "ukr-mykolayiv",
"lat": 46.30317322627217,
"lon": 31.073053845170914,
"name": null,
"topDestination": "NIKOLAEV"
},
"endAnchorage": {
"anchorageId": "40c64c1b",
"atDock": false,
"distanceFromShoreKm": 20,
"flag": "UKR",
"id": "ukr-mykolayiv",
"lat": 46.37575548639163,
"lon": 31.009052942845823,
"name": null,
"topDestination": "NIKOLAEV"
}
}
}
]
}Get loitering events with a custom polygon and duration filter (POST)
Example POST request for loitering events inside a custom GeoJSON polygon, filtered by event duration.
Get fishing events within an existing region (Senegal EEZ) (POST)
Example POST request for apparent fishing events inside an existing region, the Senegal EEZ.