我目前正在构建一个从 Traffic API v7 请求流量数据的客户端:
https://data.traffic.hereapi.com/v7/flow?locationReferencing=olr&…
我想解码响应中包含的 OpenLR Location Referencing 字符串,但我没有使用 Java 或 Scala,所以我无法使用提供的库。
返回的字符串如下所示:
"olr": "CCoBEAAmJQm+WSVVfAAJBQQCAxoACgUEAogZAAHtA2UACQUEAgOEADBigj0="
我已经阅读了关于 TISA OLR 和 TomTom OpenLR 之间差异的段落,并且我能够找到 TomTom OpenLR 字符串的在线解码器以及一些各种语言的库;但这些都不适用于 HERE API 返回的 OpenLR 字符串。
是否有任何资源(源代码、在线解码器、进一步文档)包含有关解码 HERE 使用的 OpenLR 字符串的详细信息?
这里的位置库会为您完成。
import com.here.platform.location.referencing.olr.OlrPrettyPrinter;
import com.here.platform.location.tpeg2.BinaryMarshallers;
import com.here.platform.location.tpeg2.olr.LinearLocationReference;
import com.here.platform.location.tpeg2.olr.OpenLRLocationReference;
import java.io.ByteArrayInputStream;
import java.util.Base64;
public class decode {
public static void main(final String[] args) {
byte[] decode = Base64.getDecoder().decode("CCoBEAAmJQm+WSVVfAAJBQQCAxoACgUEAogZAAHtA2UACQUEAgOEADBigj0=");
OpenLRLocationReference reference =
BinaryMarshallers.openLRLocationReference()
.unmarshall(new ByteArrayInputStream(decode));
System.out.println(OlrPrettyPrinter.prettyPrint((LinearLocationReference) reference.getLocationReference()));
}
}
输出如下:
type: OLR LinearLocationReference
positiveOffset: DistanceMetresMax15000(98)
negativeOffset: DistanceMetresMax15000(317)
firstReferencePoint:
coordinate: 2446716,638553 => 52.50083,13.701861
lineProperties:
bearing: 26 => 36.6°
frc: 2 (0-7, with 0 most important)
fow: 3 => single carriageway
pathProperties:
lfrcnp: 2 (0-7, with 0 most important)
dnp: 1049 m
againstDrivingDirection: false
intermediateReferencePoints: ∅
lastReferencePoint:
coordinate: 869,493 => 52.50952,13.706791
lineProperties:
bearing: 132 => 185.6°
frc: 2 [0-7], with 0 most important
fow: 3 => single carriageway
任何人都知道在哪里可以找到用于导入的库和.jar 文件:
com.here.platform.location.tpeg2.olr.LinearLocationReference; 导入 com.here.platform.location.tpeg2.olr.OpenLRLocationReference;
请问?