traccar icon indicating copy to clipboard operation
traccar copied to clipboard

Add Amap geocoder and coordinate util

Open mmzhi opened this issue 1 year ago • 12 comments

In China, geolocation encoding is commonly dominated by the use of Gaode Maps(Amap) and Baidu Maps. Other internationally used platforms are not as accurate. Moreover, China has a special system of geographic coordinates(GCJ-02). This merge request implements the geolocation encoding implementation of the Gaode map(Amap).

For this merge request I added two class, CoordinateUtil and AmapGeocoder. CoordinateUtil is mainly used to convert WGS84 to GCJ-02 coordinates, this code reference: https://github.com/dromara/hutool/blob/v5-master/hutool-core/src/main/java/cn/hutool/core/util/CoordinateUtil.java AmapGeocoder implements the interpretation of geographic coordinates of Gaode map(Amap).

mmzhi avatar Jun 20 '24 17:06 mmzhi

Re-worked the code to the code specification and the CI on github has been passed.

mmzhi avatar Jun 20 '24 17:06 mmzhi

I resubmitted the code, mainly modifying the copyright description, replacing abbreviations with complete words, and adjusting the order of latitude and longitude.

mmzhi avatar Jun 21 '24 06:06 mmzhi

In the latest commit version, I added the georeferencing interpreters of the three major map providers in China. This way, users can have more choices.

mmzhi avatar Jun 21 '24 11:06 mmzhi

In the project "traccar-web", the company name of the map manufacturer, "autoNavi", is used as the name. "amap" is a product of "autoNavi". In order to standardise the naming convention, "amap" has been changed to "autoNavi".

mmzhi avatar Jun 23 '24 09:06 mmzhi

In the project "traccar-web", the company name of the map manufacturer, "autoNavi", is used as the name. "amap" is a product of "autoNavi". In order to standardise the naming convention, "amap" has been changed to "autoNavi".

@tananaev In "traccar-web" project, autoNavi (amap) uses GCJ-02 coordinates, but openlayers does not support GCJ-02. As a result, when using autoNavi maps, the position and track of the device will be offset. Has it been considered to support GCJ-02 coordinates on "traccar-web"? I can also contribute code for this feature.

image

mmzhi avatar Jun 23 '24 10:06 mmzhi

In "traccar-web" project

Let's not discuss it here.

tananaev avatar Jun 23 '24 13:06 tananaev

在“traccar-web”项目中,地图制造商“autoNavi”的公司名称被用作名称。“amap”是“autoNavi”的产品。为了统一命名规则,“amap”已更改为“autoNavi”。

大佬,现在代码合并了吗,docker镜像好像没更新? 然后请教下这个配置怎么填 “ <entry key='geocoder.enable'>true</entry>”

“ <entry key='geocoder.key'>1d355462f845e2efb6978b215cb</entry> ” // Web服务

“ <entry key='geocoder.type'>autonavi</entry>”

“ <entry key='geocoder.url'>https://restapi.amap.com/v3/geocode/regeo</entry> ”

现在就是点显示地址没反应

602293544 avatar Jul 13 '24 13:07 602293544

在“traccar-web”项目中,地图制造商“autoNavi”的公司名称被用作名称。“amap”是“autoNavi”的产品。为了统一命名规则,“amap”已更改为“autoNavi”。

大佬,现在代码合并了吗,docker镜像好像没更新? 然后请教下这个配置怎么填 “ <entry key='geocoder.enable'>true</entry>”

“ <entry key='geocoder.key'>**********</entry> ” // Web服务

“ <entry key='geocoder.type'>autonavi</entry>”

“ <entry key='geocoder.url'>https://restapi.amap.com/v3/geocode/regeo</entry> ”

现在就是点显示地址没反应

This PR isn't megred yet, and pls hide your geocoder.key or you will leak it

meteoral avatar Jul 16 '24 12:07 meteoral

在“traccar-web”项目中,地图制造商“autoNavi”的公司名称被用作名称。“amap”是“autoNavi”的产品。为了统一命名规则,“amap”已更改为“autoNavi”。

大佬,现在代码合并了吗,docker镜像好像没更新? 然后请教下这个配置怎么填 “ <entry key='geocoder.enable'>true</entry>” “ <entry key='geocoder.key'>**********</entry> ” // Web服务 “ <entry key='geocoder.type'>autonavi</entry>” “ <entry key='geocoder.url'>https://restapi.amap.com/v3/geocode/regeo</entry> ” 现在就是点显示地址没反应

This PR isn't megred yet, and pls hide your geocoder.key or you will leak it

thanks, the geocoder.key is not correct 😄

602293544 avatar Jul 16 '24 13:07 602293544

在“traccar-web”项目中,地图制造商“autoNavi”的公司名称被默认名称。“amap”是“autoNavi”的产品。为了统一命名规则,“amap”已更改为“autoNavi”。

大佬,现在代码合并了吗,docker镜像好像没更新? 然后请教下这个配置怎么填 “ <entry key='geocoder.enable'>true</entry>”

“ <entry key='geocoder.key'>1d355462f845e2efb6978b215cb</entry> ” // Web服务

“ <entry key='geocoder.type'>autonavi</entry>”

“ <entry key='geocoder.url'>https://restapi.amap.com/v3/geocode/regeo</entry> ”

现在就是点显示地址没反应

Currently the server does not support the address translation of Chinese map manufacturers, although the front-end support for the Gaode map, but there will be a map offset problem, the back-end I have submitted a merger request, the front-end due to the fact that I have more things to do lately, do not have too much time to look at the project, the follow-up I think about how to help the project to solve the problem of Chinese map offset!

mmzhi avatar Jul 22 '24 05:07 mmzhi

waiting for traccar that support chinease map like baidu/amap

carolinechenying avatar Nov 05 '24 02:11 carolinechenying

有支持gcj02的计划吗?

cheng2004237 avatar Apr 23 '25 10:04 cheng2004237