0

I've been using the HERE Java library to decode binary TPEG files, however I am running into trouble when trying to get locations from the TMC location reference.

I'd like to be able to take the TMC reference (location id, country code, location table version) and get lat/long coordinates. Unfortunately, after pouring through HERE's API docs, I can't seem to find an API that would do this for me.

1 Answers1

0

Once you have a TMCLocationReference, you can transform it to a LinearLocation using LocationReferenceResolvers.tmc method.

There should be an example in Resolving a Location Reference section.

The resolver allows you to transform the TMCLocationReference into a LinearLocation containing internal HERE maps ids, which can be transformed to WKT like LineStrings using for instance the PropertyMaps.geometry method, for which you can find more details in the dev guide.

As an example, you could do something like this:

StandaloneCatalogFactory scf = new StandaloneCatalogFactory();
Catalog optimizedMap = scf.create(OptimizedMap.v2.HRN);
CacheManager cacheManager = CacheManager.withLruCache();

LocationReferenceResolver<TMCLocationReference, BidirectionalLinearLocation> tmcResolver =
        LocationReferenceResolvers.tmc(optimizedMap, cacheManager);

TMCLocationReference tmcLocationReference = ...
BidirectionalLinearLocation linearLocation = tmcResolver.resolve(tmcLocationReference);
PropertyMap<Vertex, LineStringHolder<GeoCoordinate>> geometry =
        PropertyMaps.geometry(optimizedMap, cacheManager);

LineStringHolder<GeoCoordinate> lineString =
        geometry.get(linearLocation.getLocation().getPath().get(0));