Issue using polyline routing result for POI search along route - here-api

I am trying to use the polyline string output of a v8 API route request as input for the compressedRoute parameter of a follow-up browse places request, but get a format error. Here is an example:
query:
https://router.hereapi.com/v8/routes?apiKey=&transportMode=car&origin=52.5308,13.3847&destination=52.5323,13.3789&return=polyline
response contains the compressed polyline:
...
"polyline": "BGwynmkDu39wZvBtF3InfvHrdvHvboGzF0FnGoGvHsOvR8L3NkSnVoGjIsEzFgFvHkDrJwHrJoVvb0ezoBjInV3N_iBzJ_Z",
...
Using this in a places query like:
https://places.sit.ls.hereapi.com/places/v1/browse?apiKey=&compressedRoute=BGwynmkDu39wZvBtF3InfvHrdvHvboGzF0FnGoGvHsOvR8L3NkSnVoGjIsEzFgFvHkDrJwHrJoVvb0ezoBjInV3N_iBzJ_Z;w=500&cat=petrol-station&callback=
results in the following error:
({
"status": 400,
"message": "'compressedRoute' parameter is incorrectly formatted: requirement failed: Latitude must be between -90.0 and 90.0, got: 525.30983",
"incidentId": "38e52b93-6198-479f-a52b-936198579fd8"
});
Are polyline and compressedRoute incompatible or might there be a bug?

Regarding documentation on https://developer.here.com/documentation/places/dev_guide/topics/location-contexts.html#location-contexts__here-polyline-encoding
the Places API supports "HERE polyline encoding" that is not the same format as "Flexible Polyline encoding" utilized in Routing API v8 https://github.com/heremaps/flexible-polyline also are both above not compatible.
The new Geocoding and Search API v7 is not supporting the parameters like route, compressedRoute at this moment but will be available later in next releases and will support "Flexible Polyline encoding".

Related

GMB - Removal of LocationState object in Business Information API

Google deprecated the old GMB API v4.9 account.locations.get endpoint, and replaced it with Business Information API v1 locations.get.
Code change that affects me is:
Removal of LocationState object. The existing fields have been moved into Metadata.
The new Metadata object does not return the attributes LocationState object contained before. The ones I'm interested in are:
isVerified
isPublished
isSuspended
isDisabled
isDisconnected
etc...
My question is:
How could I get this data without using deprecated endpoints?
Try Verification API getVoiceOfMerchantState
isVerified (verify),
isPublished (hasVoiceOfMerchant=true AND hasBusinessAuthority=true),
isSuspended (complyWithGuidelines),
isDuplicate (resolveOwnershipConflict).
isDisabled & isDisconnected have no equivalent in new API
As far as I can see, based on the link you have sent it is written:
Endpoint URL:
Endpoints for all business information, attributes, categories, chains and locations search are accessible at https://mybusinessbusinessinformation.googleapis.com/v1/ instead of https://mybusiness.googleapis.com/v4/
The path name for locations endpoints has changed from
accounts/accountId/locations/locationId to locations/locationId
Maybe it was better if you could provide the request uri in the previous version so we could help you more precisely. Anyhow, what I tested in the google playground is as follows:
open [https://developers.google.com/oauthplayground]
after setting your clientId and Authorisation stuff, in the Request URI write
https://mybusinessbusinessinformation.googleapis.com/v1/locations/XXXXX?readMask=storeCode,metadata,profile,serviceArea,labels,adWordsLocationExtensions
instead of XXXXX, write your locationId
you can write different readMask fields, The possible fields for readMask are:
play with different fields to check if you have your desired one or not readMask="storeCode,regularHours,name,languageCode,title,phoneNumbers,categories,storefrontAddress,websiteUri,regularHours,specialHours,serviceArea,labels,adWordsLocationExtensions,latlng,openInfo,metadata,profile,relationshipData,moreHours";
If above does not help you, in the link below I see that all metadata attribute of a location might be:
Click [here] (https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations#Location.Metadata)

HERE Routing API V8: How to get route with multiple pass through waypoints

In v7, this is the way of getting route with multiple passthrough waypoints:
https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=32.353514,-61.126775&waypoint1=passThrough!32.365181,-61.102086&waypoint2=32.360273,-61.091979&mode=fastest;pedestrian...
In v8 api reference, there's "via" which seems to be used for stop over waypoints.
I tried https://router.hereapi.com/v8/routes?transportMode=pedestrian&return=summary,polyline,actions,instructions&origin=42.353514,-71.126775;42.365181,-71.102086&destination=42.360273,-71.091979&via=42.365181,-71.102086..
It's generating 2 legs ("section" in v8 definition) in the route. I'm expecting 1 leg.
This v8 developer guide page mentioned passThrough:
Waypoints may represent stopover points (that is, points where some time will be spent before retaking the route), or passthrough points that only influence the route's shape, but where no actual stop is carried out.
But I wasn't able to figure out how to query a route with multiple pass through points in v8.
Any advice?
Thanks!!
I am not sure if returning 2 sections instead of one in V8 is an issue.
Regarding the passthrough point, it's described in API reference as WaypointOptions for query parameter via:
Supported waypoint options:
- stopDuration: desired duration for the stop, in seconds.
So I assume that all requests treat via parameter without option stopDuration as passthrough point. But you always can add !stopDuration=0 to be 100% sure.
This request (with stopDuration=0 or without this option) https://router.hereapi.com/v8/routes?transportMode=car&return=travelSummary,summary,polyline,actions&origin=42.353514,-71.126775&destination=42.360273,-71.091979&via=42.365181,-71.102086!stopDuration=0&apikey=YOUR_API_KEY
returns summary:
"summary": {
"duration": 714,
"length": 3893,
"baseDuration": 637
}
and this request with stopDuration=900
https://router.hereapi.com/v8/routes?transportMode=car&return=travelSummary,summary,polyline,actions&origin=42.353514,-71.126775&destination=42.360273,-71.091979&via=42.365181,-71.102086!stopDuration=900&apikey=YOUR_API_KEY
returns summary:
"summary": {
"duration": 714,
"length": 3893,
"baseDuration": 1537
}
As you can see baseDuration was increased by 900 as requested.
Alternative option to solve this type of problem you can sent the two request.
For example : A-->B
B-->C
You pass the request like this
First request A-->B
https://router.hereapi.com/v8/routes?transportMode=pedestrian&return=summary,polyline,actions,instructions&origin=42.353514,-71.126775;42.365181,-71.102086&destination=42.365181,-71.102086
Second request B-->C
https://router.hereapi.com/v8/routes?transportMode=pedestrian&return=summary,polyline,actions,instructions&origin=42.365181,-71.102086&destination=42.360273,-71.091979
enter code here
Now add the result of both, you will get the desired distance and time.

Kronos API v2 - including multiple query parameters in a request

I am trying to access the Time Entries object via the Kronos API v2.
The documentation says that there are two required Query Parameters: start_date and end_date.
I am able to query the endpoint including one of the parameters at a time but am not able to enter both. And, I find the documentation quite lacking.
The root of the endpoint is:
https://secure.saashr.com/ta/rest/v2/companies/{cid}/time-entries
Here are things I have tried to suffix to the above endpoint:
?start_date=2019-11-01&end_date=2019-12-01
?start_date=2019-11-01|end_date=2019-12-01
?start_date=2019-11-01 end_date=2019-12-01
?start_date=2019-11-01?end_date=2019-12-01
?start_date=2019-11-01:end_date=2019-12-01
?filter=start_date:=:2019-11-01|end_date:=:2019-12-01
I also tried including quotes around the dates.
Everything results in some 400 level error when querying the API. With most of the above suffixes, it recognizes start_date but not the end_date. In this case, the error is:
{'code': 400, 'message': 'Missing required: end_date'}]
Note, above {cid} is replaced with the company's id.
In summary, how should I include two query parameters in the Kronos API?
The first option is correct.
https://secure.saashr.com/ta/rest/v2/companies/{cid}/time-entries?start_date=2019-11-01&end_date=2019-12-01
should work just fine.
Could you provide full URL you set in request?

HERE LinkId from route not found in PDE (Platform Data Extension)

UPDATE: It's happening again, also with Fleet API. Please see additional examples at end of the post.
I'm using HERE's REST API to calculate a route, then ask for additional data for each link / route segment by querying HERE's Platform Data Extension (PDE). This usually works fine, but now I've run into a link id that is not recognised by PDE.
Are these services not in sync, or am I doing something wrong?
I didn't have any issue in the past weeks, and it still works fine for most link ids, so this could either be a new problem or a very singular issue. I searched in the HERE API documentation and on Stackoverflow, but couldn't find anything related.
Route request (A24 Berlin towards Hamburg): https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!52.7091,13.0356&waypoint1=geo!52.7193,12.9608&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
The json response (below) contains a link with permanent id 1199057935 at Anschlussstelle Kremmen.
The PDE request gives an empty response: https://pde.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1199057935&app_id=xxx&app_code=yyy
{"Layers":[]}
Instead, I would expect the data of the containing tile, e.g. what I get for 1199057936
{"Layers":[{"layer":"ROAD_GEOM_FC1","level":9,"tileXYs":[{"x":548,"y":405}]}]}
I also tried the PDE request with ROAD_GEOM_FC1 and prefixing the id with + (values=+1199057935). Other link ids of the route return the expected tile information.
For completeness, here's the link's json from the routing response:
{
"linkId":"+1199057935",
"shape":["52.7175629,12.976613","52.7177131,12.9749393"],
"firstPoint":28,
"lastPoint":29,
"length":114,
"remainDistance":1095,
"remainTime":39,
"nextLink":"+1199057936",
"maneuver":"M2",
"speedLimit":33.3333359,
"dynamicSpeedInfo":{"trafficSpeed":16.3888893,"trafficTime":7,"baseSpeed":27.5,"baseTime":4,"jamFactor":5.7118645},
"flags":["motorway"],
"functionalClass":1,
"roadNumber":"A24",
"timezone":"+0100",
"roadName":"",
"consumption":0,
"_type":"PrivateTransportLinkType"
}
UPDATE 2019-05-27:
I get a route that contains link id 1239826684 from https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!52.5066,13.4299&waypoint1=geo!52.5282,13.4265&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
Using fleet endpoint redirects to same call as above, including link id 1239826684: https://fleet.api.here.com/2/calculateroute.json?waypoint0=geo!52.5066,13.4299&waypoint1=geo!52.5282,13.4265&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
PDE returns [] for that link id: https://pde.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1239826684&app_id=xxx&app_code=yyy
Fleet API returns [] for that link id: http://fleet.cit.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1239826684&app_id=xxx&app_code=yyy
Seems the underlying geo-data is not in sync, and using different APIs does not help. Any other solution?
You can try Fleet telematics group of API's over basic routing and PDE as Fleet Telematics provides whole routing solution .
Please find the below API request which is giving expected response for the id-1199057935
http://fleet.cit.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1199057935&app_id=xxxx&app_code=yyyy
Response :
{
Layers: [
{
layer: "ROAD_GEOM_FC1",
level: 9,
tileXYs: [
{
x: 548,
y: 405
}
]
}
]
}
for more information kindly go through the below documentation
https://developer.here.com/documentation/fleet-telematics/api-reference.html#operation%2FindexJSONUsingGET
Hope this will help.

meanuver's direction attribute in Routing service's Response

I'm testing the routing service in API 3.0 and I canĀ“t find the attribute "direction" in meanuver, this attribute exists in API 2.5, it attribute indicates the direction of the instruction for example "forward, straight, right.."
Does anybody know if there is some attribute that indicates the direction of the instruccion in the API 3.0?
Thanks.
As discussed in the migration guide, there is a fundamental shift in the use of services between the 2.x and 3.0 Here Maps APIs for JavaScript - previously the Manager objects decided a fixed format of for the request to the underlying REST APIs and encapsulated the response. Whereas now the full range of parameters can (and should) be set by the developer.
In the routing case the question is not so much "What can the 3.0 API do?" as "How was the REST request fixed by the 2.x API and how can I mimic the parts of that request that I need?".
Looking at the Legacy API playground simple routing example, the underlying REST request is:
http://route.cit.api.here.com/routing/7.2/calculateroute.json?routeattributes=shape&maneuverattributes=all&jsonAttributes=1&waypoint0=geo!52.516,13.388&waypoint1=geo!52.517,13.395&language=en-GB&mode=shortest;car;traffic:default;tollroad:-1&app_id=APP_ID&app_code=TOKEN...
This can be reproduced precisely in the 3.x API with the following:
var router = platform.getRoutingService(),
routeRequestParams = {
routeattributes: 'shape',
maneuverattributes: 'all',
jsonAttributes :'1',
waypoint0: '52.516,13.388',
waypoint1: '52.517,13.395',
language: 'en-GB',
mode: 'shortest;car;traffic:default;tollroad:-1'
};
router.calculateRoute(...);
The next question here is what parameters do you really need for your application? The list for the calculateRoute endpoint of the underlying REST Routing 7.2 API includes the description of maneuverattributes showing how to obtain directions - with maneuverattributes=...,direction
So it may be possible to reduce the routeRequestParams to something like:
var routeRequestParams = {
routeattributes: 'shape',
maneuverattributes: 'position,length,direction',
...etc...
So in summary, you'll need to consult the REST Routing API documentation to define what you need first, before passing those parameters into the query of the Maps API for JavaScript calculateRoute() call.

Resources