Baidu Maps is one of China’s most popular and widely used mapping services. It is developed specifically for the Chinese market, meaning the map data (including road networks, landmarks, and real-time traffic) is highly detailed and localized.
Often dubbed the "Google Maps of China," Baidu Maps offers powerful features for website owners looking to cater to Chinese visitors. If your business is targeting China’s massive online audience, integrating Baidu Maps is one way to show locations.
If you’re looking to leverage Baidu Maps for Chinese website visitors, there are currently two main options:
Baidu Maps allows sharing individual locations via a URL, which you can embed in an iframe. This doesn’t require an API key so is easy to set up but comes with the following downsides:
Baidu Maps embed doesn’t offer the same interactivity as with an API.
Using a Baidu Maps URL in an iframe embed can result in poor user experience because Baidu’s URLs are not built for embeds.
For the best results, you may need to seek professional Baidu Maps expertise.
Here’s how you can get started with a Baidu Maps iframe embed:
Go to map.baidu.com in a browser and search for your location.
Zoom and adjust the view as desired.
Click the "Share" (分享) button on the map interface.
Copy the short URL provided (e.g., http://j.map.baidu.com/abc123).
Use the share link in an iframe:
iframe src="http://j.map.baidu.com/abc123" width="600" height="400" frameborder="0" allowfullscreen>
Baidu Maps offers an API that lets developers embed interactive maps into websites. It’s a more feature-rich way to display locations, routes, or points of interest directly on your pages but comes with the following downsides:
To use Baidu Maps API, a Chinese business license and phone number is required.
Baidu Maps API can require significant development time to migrate Google Maps features.
Here’s how to get started with Baidu Maps API, with a focus on overcoming the language barrier and setting up a functional map for your site.
You’ll need a Baidu developer account, which you can create via this link. The site is in Chinese, but non-speakers can use browser translation tools like Google Translate in browser to navigate. Note that Google Translate may not work if you are attempting to access this via a native Chinese browser from China, but there are alternative tools.
Once registered, apply for an API key here. This requires basic info about your website, intended use, similar to Google’s Developer console if you’re familiar with that. The official documentation (lbsyun.baidu.com) is Chinese-only but you can use translation browser plug-ins to some extent.
Once your application is approved, you’ll receive your API key.
With your API key, you can integrate Baidu Maps into your site using a script like the following, replacing the x’s with your API key:
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=xxxxxxxxxxxxxxxxxxxxxx">
Add the script to a container for the map and adjust the width and height in the CSS to fit your web design, as well as any further customizations such as adding a marker, info window (to show details when the marker is clicked) or map type (normal, satellite, hybrid).
The script URL and its parameters are documented on the Baidu Maps API page. Since it’s in Chinese, use a translation tool or search for English guides like those on GitHub or Stack Overflow.
After adding the script, ensure your webpage is hosted on the domain you registered with Baidu (or use localhost for testing, if you allowed it in your application settings).
Open the page in a browser and check the console for errors (e.g., “Invalid AK” means the key is wrong or not authorized).
Coordinates: If you’re starting with Google Maps coordinates (WGS-84), convert them to Baidu’s BD-09 system using a tool like this online converter and take offsets into account (e.g., +0.006 to longitude and latitude).
Using a third-party library: react-baidu-maps is a popular React library that simplifies integration with English documentation. It wraps the Baidu API, letting you add maps without wrestling with the original docs.
Translation tools: Use tools like DeepL or Google Translate to decode key sections of the official docs if you need specifics (e.g., customizing map styles) or collaborate with a native speaker to ensure labels and instructions make sense to your audience.
Tutorials: Look for English-language guides on platforms like Medium or GitHub. Search terms like “Baidu Maps API English tutorial” can unearth developer-written walkthroughs.
Hiring a developer: Beyond translation tools, a freelancer familiar with Baidu Maps can handle setup and maintenance.
Additional resources: Forums like Stack Overflow often have threads on Baidu Maps integration where you can search for English posts or ask your own question.
To use Baidu Maps API, a Chinese business license and phone number is required.