Batch Geocoder API, how to get extra road attributes - here-api

Using the Batch reverse-Geocoder API, is it possible to get additional road attributes, like:
SpeedLimit
LinkFlags
SideOfStreet
Thanks!

For getting the side of street you have to first add parameter
locationattributes=mapReference
and request the output field
mapReferenceSideOfStreet
in the outcols parameter.
Example:
&locationattributes=mapReference&outcols=city,district,street,mapReferenceSideOfStreet

Related

Routing with avoid area and geofence / polygon

I want to avoid specific streets when using the routing API. I have data points to create a geofence or polygon to represent those specific streets.
The router API accepts only up to 20 bounding boxes. I tried to send 20 avoid area bounding boxes to represent the road, but the result is not reliable (e.g. on diagonal roads).
Is there a way to send a geofence/polygon instead of bounding boxes?
Or any other way to avoid certain streets?
Thank you very much
Please try to use avoid[segments] instead of avoid[areas] for avoiding specific roads. In the case of having too many roads to avoid, you can also put the avoid[segments] parameters into request body and send a POST request to the same endpoint.
In order to get the segmentId of the roads you would like to avoid, you can do a normal routing call with parameter spans=segmentId added and then look at the topologySegmentId attributes in spans section of the response.
https://developer.here.com/documentation/routing-api/api-reference-swagger.html
HERE Routing API now supports polygons for avoid area, https://www.here.com/learn/blog/routing-supports-polygons-for-avoid-areas
You have to make below calls for your usecase.
1>Rest call to get segmentId For the route.
https://router.hereapi.com/v8/routes? apikey={your_app_id}& origin=32.834496,74.81515& destination=32.811632,75.816037& return=polyline,summary,actions,instructions& spans=segmentId& transportMode=car&
2>Rest Call to get the get Route with avoid[segments]
https://router.hereapi.com/v8/routes? apikey={your_app_id}& origin=32.834496,74.81515& destination=32.811632,74.816037& return=polyline,summary,actions,instructions& spans=segmentId& transportMode=car& avoid[segments]=here:cm:segment:808368834,here:cm:segment:808095972

Fleet Telematics Route Matching, query more attributes for each route link

I'm evaluating the Fleet Telematics Route Matching service and i'm trying to retrieve more link attributes directly in the response. How can this be achieved?
I created a Freemium account on HERE.com and tried the basic example from the documentation: https://developer.here.com/documentation/route-match/topics/quick-start-gps-trace-route.html.
In the documentation of the service i found that it should be possible to get more attributes regarding the route links returned in the response: https://developer.here.com/documentation/route-match/topics/attributes-along-route.html
The following works (of course 123 is not my real app id, nor my real app code):
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D"
and returns:
{"RouteLinks":[{"linkId":25664478,"functionalClass":5,"confidence":1.0,"shape":"51.10168 0.39385 51.10184 0.39329","offset":0.62907,"mSecToReachLinkFromStart":2614,"linkLength":43.08},{"linkId":1022687683,"functionalClass":4,"confidence":1.0,"shape":"51.10184 0.39329 51.10214 0.39345","mSecToReachLinkFromStart":8376,"linkLength":35.21},{"linkId":1022687684,"functionalClass":4,"confidence":1.0,"shape":"51.10214 0.39345 51.10224 0.3935","mSecToReachLinkFromStart":10284,"linkLength":11.66},{"linkId":25664459,"functionalClass":4,"confidence":1.0,"shape":"51.10224 0.3935 51.10232 0.39354","mSecToReachLinkFromStart":11811,"linkLength":9.33},{"linkId":781742854,"functionalClass":4,"confidence":1.0,"shape":"51.10232 0.39354 51.10245 0.39361 51.10255 0.39367","mSecToReachLinkFromStart":16214,"linkLength":27.16},{"linkId":781742855,"functionalClass":4,"confidence":1.0,"shape":"51.10255 0.39367 51.10269 0.39376","mSecToReachLinkFromStart":16255,"linkLength":16.8},{"linkId":25664450,"functionalClass":4,"confidence":1.0,"shape":"51.10269 0.39376 51.10292 0.39391 51.10306 0.39401","mSecToReachLinkFromStart":19004,"linkLength":44.74},{"linkId":25664444,"functionalClass":4,"confidence":1.0,"shape":"51.10306 0.39401 51.10324 0.39413","mSecToReachLinkFromStart":29879,"linkLength":21.72},{"linkId":25664440,"functionalClass":4,"confidence":1.0,"shape":"51.10324 0.39413 51.10335 0.3942 51.1035 0.39431 51.1036 0.39439","mSecToReachLinkFromStart":37082,"linkLength":44.02},{"linkId":25664427,"functionalClass":4,"confidence":1.0,"shape":"51.1036 0.39439 51.10369 0.39446 51.10378 0.39453","mSecToReachLinkFromStart":40731,"linkLength":22.3},{"linkId":860272608,"functionalClass":4,"confidence":1.0,"shape":"51.10378 0.39453 51.10394 0.39465","mSecToReachLinkFromStart":43951,"linkLength":19.68},{"linkId":860272609,"functionalClass":4,"confidence":1.0,"shape":"51.10394 0.39465 51.10417 0.39482","mSecToReachLinkFromStart":44659,"linkLength":28.22},{"linkId":781742870,"functionalClass":4,"confidence":1.0,"shape":"51.10417 0.39482 51.10427 0.39489 51.10439 0.39497 51.10452 0.39505 51.10463 0.39512","mSecToReachLinkFromStart":48568,"linkLength":55.33},{"linkId":1022687692,"functionalClass":4,"confidence":1.0,"shape":"51.10463 0.39512 51.10483 0.39523","mSecToReachLinkFromStart":57622,"linkLength":23.55},{"linkId":1022687693,"functionalClass":4,"confidence":1.0,"shape":"51.10483 0.39523 51.10547 0.39554","offset":0.28475,"mSecToReachLinkFromStart":64944,"linkLength":74.44}],"TracePoints":[{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10177,"latMatched":51.10178,"linkIdMatched":25664478,"lon":0.39349,"lonMatched":0.3935,"matchDistance":1.46,"matchOffsetOnLink":0.6290743846692971,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10181,"latMatched":51.10182,"linkIdMatched":25664478,"lon":0.39335,"lonMatched":0.39336,"matchDistance":1.46,"matchOffsetOnLink":0.8790743846674338,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":22.0,"lat":51.10255,"latMatched":51.10255,"linkIdMatched":781742855,"lon":0.39366,"lonMatched":0.39367,"matchDistance":1.11,"matchOffsetOnLink":0.0,"minError":1.0,"routeLinkSeqNrMatched":5,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":25.0,"lat":51.10398,"latMatched":51.10398,"linkIdMatched":860272609,"lon":0.39466,"lonMatched":0.39468,"matchDistance":1.87,"matchOffsetOnLink":0.1535150210712758,"minError":1.0,"routeLinkSeqNrMatched":11,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":17.0,"lat":51.10501,"latMatched":51.10501,"linkIdMatched":1022687693,"lon":0.39533,"lonMatched":0.39532,"matchDistance":1.33,"matchOffsetOnLink":0.2847498087963734,"minError":1.0,"routeLinkSeqNrMatched":14,"* Connection #0 to host rme.cit.api.here.com left intact speedMps":0.0,"timestamp":0}],"Warnings":[],"MapVersion":"LATEST"}
However, my tries to get more attributes regarding the road links have not been successful so far. No matter which attributes i select, the following query does not work:
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ID"
and instead of a proper response, i just get
{"faultCode":"6a8a9966-b2eb-4a54-8f58-2f36e501bb94","responseCode":"400 Bad Request","message":"Invalid layer attribute parameter."}
Using a layer instead of an attributes does not work either:
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FC5"
This returns the same error as above.
Based on the documentation i would expect that there is some way to retrieve more link attributes directly in the response, but i cannot figure out how to do that. Obviously, i must be doing something wrong.
Please refer the following link
https://developer.here.com/documentation/route-match/topics/resource-matchroute-request.html
you can easily retrieve the attributes for the particular layers with the following command where the attributes parameter should be LINK_ATTRIBUTE_FCn(*). It is also possible to retrieve the particular information from these attributes with LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE,RAMP,URBAN).
https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FCn(*)
Similarly, you can get the attributes for the other layers (i.e. ROAD_GEOM_FCn(*))
Hope this helps you.
Best Regards,
Jeyaprakash Rajagopal

HERE maps - getting road type based on gps coordinates

Is it possible to get the type of road (e.g. motorway, primary, secondary) for given coordinates, using HERE maps RESTful API?
You can use the "getlinkinfo" endpoint of the routing service together with the "linkattributes=all" parameter to get the corresponding functional class value of a certain link:
http://route.st.nlp.nokia.com/routing/6.2/getlinkinfo.xml?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&waypoint=50.05564304861044,8.38889128575724&linkattributes=all
More info about the functional class value:
You can use the "calculateroute" endpoint together with &attributes=LINK_ATTRIBUTE_FC1(*) to get the road type. It returns a json value "ROUTE_TYPES" from 1...6 and each integer depending on the "ISO_COUNTRY_CODE" represents a road type. eg. ISO_COUNTRY_CODE:DEU with ROUTE_TYPES:2 is an Autobahn (motorway).
Different road types and their iso code can be found in the below link.
https://fleet.ls.hereapi.com/1/doc/attributes.html?region=SAM&release=20111&apikey= your api key
Also an example url to is below
https://fleet.ls.hereapi.com/2/calculateroute.json?&apiKey=your_api_key&mode=car&waypoint0=50.10992,8.69030&waypoint1=50.00658,8.29096&attributes=LINK_ATTRIBUTE_FC1(*)
please remember to add your own api key.

Google Maps Javascript API, DirectionsService, list of countries

I am creating a route using google.maps.DirectionsService.
What would be the best method to get the list of countries the route goes through?
I can't find this info in the DirectionsResult https://developers.google.com/maps/documentation/javascript/reference#DirectionsResult
Each route from the routes array have a overview_path array with all the coordinates. You can geocode each of this coordinates and get the country of it (remember the limitation of geocoding calls!). Isn't the best solution but....

Acquired the building name using GPS Coordinates

I am writing an app to use GPS coordinates obtained by the cell phone itself to retrieve the building name of that location.
For example, if I use this http URL to request with Google Place API:
https://maps.googleapis.com/maps/api/place/search/json?location=40.805112,-73.960349&radius=10&sensor=false&key="YourKey"
I can only get the street name of this coordinate through this.
But if I type "40.805112,-73.960349" in maps.google.com. I can get the exact building name. SO I was wondering how can I use Google Map API to obtain the building name I want.
Thank you very much about this!!!
The first result in the request you provided contains "name" : "Church of Notre Dame", isn't this what you are looking for?
A better request if you are only interested in the place name at this location would be to use the rankby=distance parameter instead or radius and to filter by type=establishment:
https://maps.googleapis.com/maps/api/place/search/json?location=40.805112,-73.960349&rankby=distance&types=establishment&sensor=false&key=YOUR_API_KEY
This would return the closest place at the given location.

Resources