TRADING ECONOMICS | GIS COMTRADE
UN Comtrade bilateral trade data returned as LineString geometry — each feature connects an origin country’s centroid to its trading partner, covering over 200 reporting countries since 1962. Line thickness can be scaled by trade value for visual impact.
Export Flows
Trade exports from a specific country to all trading partners.
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/gis/collections/comtrade/exports/china/items?c={your_api_key}'
data = requests.get(url).json()
print(data)
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/gis/collections/comtrade/exports/china/items?c=${your_api_key}`)
console.log(response.data)
})()
Response
[
{
"type": "Feature",
"id": "CHN_USA_2023_export",
"geometry": {
"type": "LineString",
"coordinates": [ [116.40, 39.90], [-77.03, 38.89] ]
},
"properties": {
"origin_country": "China",
"origin_iso3": "CHN",
"destination_country": "United States",
"destination_iso3": "USA",
"trade_value": 500000000000,
"year": 2023,
"trade_type": "export",
"category": "Total",
"last_update": "2024-03-15",
"importance": 1
}
}
]
Import Flows
Trade imports into a specific country from all trading partners.
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/gis/collections/comtrade/imports/germany/items?c={your_api_key}'
data = requests.get(url).json()
print(data)
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/gis/collections/comtrade/imports/germany/items?c=${your_api_key}`)
console.log(response.data)
})()
Response
[
{
"type": "Feature",
"id": "DEU_CHN_2023_import",
"geometry": {
"type": "LineString",
"coordinates": [ [10.45, 51.16], [116.40, 39.90] ]
},
"properties": {
"origin_country": "China",
"origin_iso3": "CHN",
"destination_country": "Germany",
"destination_iso3": "DEU",
"trade_value": 109000000000,
"year": 2023,
"trade_type": "import",
"category": "Total",
"last_update": "2024-03-15",
"importance": 1
}
}
]
Using Parameters
Filter by partner countries and year range.
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/gis/collections/comtrade/exports/china/items?c={your_api_key}&partners=France,Italy,United States&yearFrom=2020&yearTo=2025'
data = requests.get(url).json()
print(data)
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/gis/collections/comtrade/exports/china/items?c=${your_api_key}&partners=France,Italy,United States&yearFrom=2020&yearTo=2025`)
console.log(response.data)
})()
Response
[
{
"type": "Feature",
"id": "CHN_FRA_2022_export",
"geometry": {
"type": "LineString",
"coordinates": [ [116.40, 39.90], [2.35, 48.86] ]
},
"properties": {
"origin_country": "China",
"origin_iso3": "CHN",
"destination_country": "France",
"destination_iso3": "FRA",
"trade_value": 72000000000,
"year": 2022,
"trade_type": "export",
"category": "Total",
"last_update": "2024-03-15",
"importance": 3
}
}
]
Response Properties
| Property | Type | Description |
|---|---|---|
origin_country | string | Exporting country name |
origin_iso3 | string | Exporting country ISO3 code |
destination_country | string | Importing country name |
destination_iso3 | string | Importing country ISO3 code |
trade_value | number | Trade value in USD |
year | int | Data year |
trade_type | string | export or import |
category | string | Trade category (e.g. Total) |
last_update | string | Last data update date |
importance | int | Trade partner ranking |