Open kyooryoo opened 1 year ago
According to the following HERE documentation, HERE HD Map use special encoding method for coordinates: https://developer.here.com/documentation/here-lanes/dev_guide/topics/hd-map-coordinate-encoding.html Can you add the feature for encoding and decoding the HERE HD Map coordinates such as follows:
def decode_here_2d_coordinate_int(encoded): encoded_bin = bin(int(encoded))[2:].rjust(64, '0') lon_bin = encoded_bin[1::2] lat_bin = encoded_bin[2::2] lat_bin = lat_bin.rjust(32, lat_bin[0]) lon_uint = int(lon_bin, base=2) lat_uint = int(lat_bin, base=2) lon_int = struct.unpack('i', struct.pack('I', lon_uint))[0] lat_int = struct.unpack('i', struct.pack('I', lat_uint))[0] return lat_int, lon_int def decode_here_2d_coordinate_diffs_offset(encoded_diffs, encoded_reference): coords = [] #lat_int, lon_int = 0, 0 lat_int, lon_int = decode_here_2d_coordinate_int(encoded_reference) for encoded in encoded_diffs: diff_lat_int, diff_lon_int = decode_here_2d_coordinate_int(encoded) lat_int ^= diff_lat_int lon_int ^= diff_lon_int lon_deg = lon_int * (360 / 2 ** 32) lat_deg = lat_int * (180 / 2 ** 31) coords.append((lat_deg, lon_deg)) return coords
@kyooryoo sorry for my late reply but I have so much got to do with other stuff, please feel free to open a PR with your suggested changes.
According to the following HERE documentation, HERE HD Map use special encoding method for coordinates: https://developer.here.com/documentation/here-lanes/dev_guide/topics/hd-map-coordinate-encoding.html Can you add the feature for encoding and decoding the HERE HD Map coordinates such as follows: