If you have been to China, you might already know that there’s no Google map here. Then what happens if you want to make an app with a map?

No worries, although different, but not too different. China’s two biggest geolocation provider: Baidu and Gaode(AMap) can be quite handy too.

What to choose? Depends on your requirement

If you are just looking for a map to display a static location, either Baidu/Gaode can do the trick.

If you are looking for location tracking, drawing poly lines on map, heat map, indoor map, there’s a nice react native module that supports it.

The process goes like 1. Apply for an access key 2. npm install/yarn install the module into your app 3. Link the necessary library and frameworks

To apply for Baidu map api

http://lbsyun.baidu.com/

To apply for Gaode map api

http://lbs.amap.com/

Baidu Map react native module

https://github.com/lovebing/react-native-baidu-map

Gaode react native module

https://github.com/qiuxiang/react-native-amap3d

Things that I have learned

The coordinates provided by react native Geolocation module are DIFFERENT from the coordinates on Baidu or Gaode map.

If you have a large react native project, experiment on a fresh react native build first, because there are a lot of libraries and frameworks to be link, if something goes wrong, your whole project ends up with too many unnecessary bugs.

Distance interval and timeouts are crucial to prevent GPS from drifting if you are doing location tracking.

If you are drawing poly lines with the coordinates that you collected, you could use Douglas Peucker algorithm to smooth out the lines

If you have any question, please feel free to share it below at the comment section.