cyang-kth / fmm

Fast map matching, an open source framework in C++
https://fmm-wiki.github.io/
Apache License 2.0
878 stars 205 forks source link

The error of h3 geometry generation #197

Closed cyang-kth closed 3 years ago

cyang-kth commented 3 years ago

The current implementation regarding the lng lat order is wrong. In standard WKT and GeoJSON, the x is lng and y is lat.

A position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation MAY be included as an optional third element.

https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1

The current export order is wrong.

https://github.com/cyang-kth/fmm/blob/6b43a16ea2b78cbbb03d79eb9fc7a45c4732a8fa/src/mm/h3mm/h3_util.hpp#L16-L33

Another issue is also in this file

https://github.com/cyang-kth/fmm/blob/6b43a16ea2b78cbbb03d79eb9fc7a45c4732a8fa/src/mm/h3mm/h3_util.hpp#L35-L40

The function API says https://github.com/uber/h3/blob/32b6e07f41353e9def5a778fc5a4a7c8cdddd93a/src/h3lib/include/latLng.h

void setGeoDegs(LatLng *p, double latDegs, double lngDegs);

The current implementation sometimes still generate the reasonable result but should be corrected.

cyang-kth commented 3 years ago

Fixed at this commit https://github.com/cyang-kth/fmm/commit/9eaa303ad60a954eb2843612d1a27163f0ad0bcb