How to Convert Geographic Coordinates Between WGS84, GCJ02 and BD09 with an API
1. What problem are we solving
Converting geographic coordinates between different reference systems can be error-prone and time-consuming.
Each system (WGS84, GCJ02 or BD09) uses its own datum, and direct arithmetic often yields inaccurate locations.
Developers who build mapping, navigation or location-based services need a reliable way to translate coordinates without having to maintain complex geodesy code.
This guide shows how to perform high-precision conversions using an API so you can focus on building features instead of handling math.
2. When you need this solution
You may need to convert coordinates when:
- Integrating GPS data into Chinese map services that expect GCJ02 or BD09
- Standardizing data from multiple providers into a single coordinate system
- Building a mobile app that uses WGS84 for device location but displays markers on a GCJ02-based map
- Migrating datasets between systems for analysis or storage
3. How the API solution works
Instead of implementing transformation formulas yourself, a coordinate conversion API handles the heavy lifting.
You specify the source coordinate system, the target system and the point to convert, and the API uses high-precision algorithms to compute the new coordinates.
The service returns a JSON object containing the original and converted values, along with status information.
Because the API abstracts the conversion logic, it works consistently across WGS84, GCJ02 and BD09 and is easy to integrate into any language.
4. Step-by-step: Convert coordinates using an API
Step 1: Determine the source and target coordinate systems and collect the [longitude,latitude] value you want to convert
Step 2: Send a GET request to the coordinate conversion API endpoint with appkey, from, to and value parameters
Step 3: Parse the JSON response to retrieve the converted coordinate
Step 4: Use the converted coordinate in your map, database or location-based service
5. API request example
cURL
curl -X GET "https://api.gugudata.io/v1/location/coordinateconverter?appkey=YOUR_APPKEY&from=WGS84&to=GCJ02&value=120.54,32.74"
Example response:
{
"dataStatus": {
"requestParameter": "appkey=YOUR_APPKEY&from=WGS84&to=GCJ02&value=120.54,32.74",
"statusCode": 100,
"statusDescription": "请求成功。",
"responseDateTime": "2026-01-27T12:00:00Z",
"dataTotalCount": 1
},
"data": {
"coordinateFrom": "WGS84",
"coordinateTo": "GCJ02",
"coordinateSourceValue": "[120.54,32.74]",
"coordinateDestinationValue": "[120.546789,32.741234]"
}
}
JavaScript (fetch)
fetch('https://api.gugudata.io/v1/location/coordinateconverter?appkey=YOUR_APPKEY&from=WGS84&to=GCJ02&value=120.54,32.74')
.then(response => response.json())
.then(data => {
const converted = data.data.coordinateDestinationValue;
console.log(converted);
})
.catch(error => {
console.error(error);
});
Python (requests)
import requests
url = "https://api.gugudata.io/v1/location/coordinateconverter"
params = {
"appkey": "YOUR_APPKEY",
"from": "WGS84",
"to": "BD09",
"value": "120.54,32.74"
}
response = requests.get(url, params=params)
data = response.json()
print(data["data"]["coordinateDestinationValue"])
6. Why use an API instead of manual conversion
Manual coordinate conversion requires knowledge of geodesy and constant updates to handle different regional datums.
An API abstracts this complexity and provides consistent, tested results without requiring you to maintain conversion logic.
Using a service also reduces development time and prevents errors that could misplace users on a map.
7. Frequently Asked Questions
Can this API convert between WGS84, GCJ02 and BD09?
Yes. You can specify any of these systems in the from and to parameters, and the API will return the corresponding converted coordinate.
How accurate is the converted coordinate?
The API uses high-precision algorithms to minimize error and is suitable for map applications, GPS navigation and location-based services. The precision is typically within a few meters.
What happens if I exceed the rate limit?
The service recommends limiting requests to 5 queries per second per IP. Exceeding this may trigger rate limiting with an error code indicating too many requests.
Do I need a secure connection?
The API supports HTTPS with TLS v1.0, v1.1, v1.2 and v1.3, and is fully compatible with Apple ATS, so you can safely call it from web and mobile apps.
8. Next steps
If you want to convert geographic coordinates without implementing complex formulas yourself, try a coordinate conversion API.
With a valid appkey you can integrate this service into your workflow in minutes and start translating coordinates between WGS84, GCJ02 and BD09.
Top comments (0)