How to retrieve data from a layer with a pipeline - here-api

I'm trying to get the average speed from the "HERE Real Time Traffic" catalog in the "Flow" layer. I could see that there was an example in the documentation:
https://developer.here.com/documentation/java-scala-dev/dev_guide/here-realtime-traffic/index.html
Thanks to the segmentID, in the example, it manages to retrieve the desired data, but in my case I don't have a segmentID and I would like to retrieve this data thanks to the gps coordinate (lat,long).
I want to know if there is a way to get the segmentID using the coordinates ? or to use the exemple but with a lat,long values.
I tried to convert the coordinates to segmentid but i didn't find an appropriete fonction to do.
I also think about using API REST to get the segmentid but i don't think it will be an good idea.

Related

HERE API - how to extract all the information about road based on GPS coordinates

I need to get as much info as possible based on GPS - road type, interaction or not, etc.
What is the right way to get it?
I've seen this question and answer
HERE maps - getting road type based on gps coordinates
but the provided link doesn't work anymore.
It looks like you want to migrate to the Routing API, specifically the getRoute call, https://developer.here.com/documentation/routing/dev_guide/topics/resource-get-route.html#resource-get-route. In the details here you can see the attribute, linkAttributes, which lets you return the information you are looking for I believe. Let me know if not.
It looks like the right way to do it to use the next POST request:
https://fleet.api.here.com/2/calculateroute.json?app_id=APP_ID&app_code=APP_CODE&routeMatch=1&mode=car&attributes=LINK_ATTRIBUTE_FCn%28%2A%29
Example of the body:
LATITUDE,LONGITUDE
37.401996,-122.041338
37.402948,-122.045580
37.403690,-122.049024

Using Socrata API distance_in_meters() function with separate latitude, longitude field

I am trying to retrieve information about trees surrounding a given location from the Socrata API.
API Endpoint Description
I found two functions within_circle(...) and distance_in_meters(...) which I could use to filter the data set. The problem is, that those functions need either a location or a point data type which is not present in the data set.
There is, however a latitude and longitude field.
Is there any method to utilize those functions or get nearby trees other way?
Tried this, but POINT(0 0) must be the point of the tree.
https://data.cityofnewyork.us/resource/nwxe-4ae8.json?$where=within_circle( 'POINT(0 0)' ,0,0,400)
I need something like this.
https://data.cityofnewyork.us/resource/nwxe-4ae8.json?$where=within_circle( make_point(latitude, longitude) ,0,0,400)
SoQL
If you have not already done so, you may want to submit this question at https://support.socrata.com. In addition to the possibility that the people there will have an answer I do not, it would serve as some feedback that a function like what you had in mind would be useful.
I cannot think of a way to do exactly what you have in mind. Really, what I mean is a way that is within your power (or mine). The owner of the dataset could create a Point column -- and you may want to reach out to the NYC open data team to ask for that if you have not already done so.
However, since the X and Y coordinates, in feet, are present, you should be able to use the Pythagorean theorem to determine the distance from any given point. For that matter, the size of a degree of latitude or longitude cannot vary that much over an area as small as NYC so you could do the same thing with those values and save having to figure out the X and Y of your reference point.
Good luck!
Jon

How to retreive speed limit from here maps given a latitude and longitude?

I'm trying to get speed limit from Here API maps but I can't find the way to do it. I tryed few example on web site but the only one that works is the one which require point of start and point of stop of the route.
I would like to get the speed limit given only one point ( or a box ). Which api do I have to use? Is there an example?
https://route.cit.api.here.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&app_code=appcode&app_id=appid
This is the waypoint one but is not what I'm looking for, I would like to pass it only a Latitude / Longitude.
Thank you
You can achieve this by using PDE API(Platform Data Extension)
You have to first map your geocordinates(lat,long) to a navigable position(lat,long) for the given coord and the Functional Class(FC1-5) it is located in. This you can achieve by a simple geocoder request
You can calculate tilexy values based on the navigable lat,long and pass it to PDE API for querying speed limit layer on that particular FC class.
Look at https://tcs.ext.here.com/examples/v3/link_speed_locator example which covers this exact usecase.
Below is a sample geocoder request. Here prox parameter is your lat,long
https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json?app_id=xxxx&app_code=yyyy&prox=50.133848, 8.715332,500&mode=retrieveAddresses&maxResults=1&additionaldata=SuppressStreetType,Unnamed&locationattributes=linkInfo
Below is a sample pde request
https://pde.cit.api.here.com/1/tiles.json?layers=SPEED_LIMITS_VAR_FC1,SPEED_LIMITS_VAR_FC2,SPEED_LIMITS_VAR_FC3,SPEED_LIMITS_VAR_FC4,SPEED_LIMITS_VAR_FC5,ROAD_GEOM_FC1,ROAD_GEOM_FC2,ROAD_GEOM_FC3,ROAD_GEOM_FC4,ROAD_GEOM_FC5&levels=9,10,11,12,13,9,10,11,12,13&tilexy=536,398,1073,797,2147,1594,4294,3188,8588,6377,536,398,1073,797,2147,1594,4294,3188,8588,6377&app_id=xxxx&app_code=yyyy
Read more about it in the developer site - https://developer.here.com/documentation/platform-data/topics/quick-start-view-map-data.html
Hope you find this useful!
The ReverseGeocoder has rarely used mode "trackPosition" (mode=trackPosition).
In combination with locationattributes=linkInfo you may retrieve the speed limit for that matching road.

How to fetch exactly same results of Google Grocery stores near to me

I am wondering to find a way to fetch exactly similar results of google grocery stores near to me
I have used the below API to get nearby grocery stores
https://maps.googleapis.com/maps/api/place/nearbysearch/json?sensor=true&radius=5000&key=AIzaSyC9rFJ90pP1oHpLrqpR2B0HtUboLaHmnDw&location=45.4940475,-73.5606149&type=supermarket&rankby=prominence
but it's not showing the all popular stores with matching to google grocery stores near to me best match (attached images).
What is the way to achieve functionality by applying filters From API? please, advice appreciated if its possible immediate replay.
Thanks
The API only will gather data by distance, prominence, and type. It is up to you how you want the data be sorted/filtered and which to display to your users.
Get your data: rankby
If rankby=distance (described under Optional parameters below) is
specified, then one or more of keyword, name, or type is required.
If you want to rank by distance, you will need to remove radius parameter form your url.
radius — Defines the distance (in meters) within which to return place
results. The maximum allowed radius is 50 000 meters. Note that radius
must not be included if rankby=distance (described under Optional
parameters below) is specified.
This will get you started. Places Library

Find cities within one hour from my location

I want to use some Google API to find a list of places within one hour from my location. I've found Google Maps Distance Matrix API but it only gives you the distance between places you specify.
What I really want to do is to paint an area in a map, I don't really need the list of places.
If I can't query by time maybe I can deal with distance (which is probably easier)
Thanks a lot!!

Resources