It seems that the Routing API requires a Lat/Lon pair to be supplied to the Waypoint parameter. I've seen other APIs that allow for the actual address to be passed, instead of the Lat/Lon. I'm wondering if anyone knows of a way to do this with the Here.com API. In many instances I can obtain the Lat/Lon first, but in one instance it's proving to be a headache, especially given the nature of the way that the REST APIs work and the fact that I'm trying to batch-process a small group of addresses at a single time. Any help would be appreciated.
Unfortunately Routing API needs a waypoint in lat, lon and required a Geocoding as a pre-requisite.
Maybe a not so nice workaround if you are facing issues with Geocoding, the Duck Duck Go provides a syntax
https://duckduckgo.com/?q=!here Junghofstraße 14,60311 Frankfurt am Main,Germany, Germany&ia=about
But you will stll have to extract the lat,lon from the final redirected url.
Related
I currently have a POC working that retrieves places information using the Places HERE api by passing Lat and Long values. Our addresses are being converted to lat and long before the api is called and we fear we might be losing precision in the process. Instead of feeding the API the coordinates, is there a way to send the actual address and get the address information back? Business name, type, etc?
res = requests.get('https://places.cit.api.here.com/places/v1/discover/here?app_id=<>&app_code=<>&at='+str(lat)+','+str(long))
Based on what I see in the API docs (https://developer.here.com/documentation/places/dev_guide/topics_api/resource-search.html) the answer is no. You can see more detail here as well: https://developer.here.com/documentation/places/dev_guide/topics/location-contexts.html. Is there a particular example of where you think geocoding is returning bad results?
Use Geocoder API to get coordinates for address and then use these coordinates to make a request to Places API.
I am trying to use HERE Maps to implement the eco-routing algorithm which we developed in our lab that requires real time traffic data as an input to the routing algorithm. So far, we were using INRIX dataset to verify our algorithms, but we decided to move to HERE Maps, and use the Traffic API to harness the power of real time traffic data.
Traffic API was very simple to use, and I managed to get the traffic data for a bounding box. It seems like that the traffic flow is passed for each TMC. My question is how to assign the traffic flow data to the links of the map using TMC. More specifically, I am wondering if there is a way to transform the TMC values to an adjacency matrix so that I can assign the traffics to each link and run my optimization algorithm over that graph? Also is it possible to overlay Open Street Maps (OSM) with the HERE Maps traffic data?
Thanks
You can associate the TMC data you get from the traffic data response to a particular link by using PDE layers LINK_TMC_FC1..5. You have look into our PDE documentation in developer site and tcs.ext.here.com/pde/maps?url_root=pde.api.here.com to see the list of layers provided.
Below is a sample PDE request for the Link TMC. Replace app id and code placeholders with actuals:
https://pde.api.here.com/1/tile.json?&layer=LINK_TMC_FC1&level=9&tilex=496&tiley=358®ion=WEU&release=18131&url_root=pde.api.here.com&app_id={YOUR-APP-ID}&app_code={YOUR-APP-CODE}
For all your other questions on creating a matrix and OSM overlay, you have to write your own algorithm. There is no straight forward function provided by Here.
Im trying our different flight api's from sabre, I understand from reading the data Im getting back is limited in development but Im not sure if it really can be THAT limited or its me doing something wrong.
1: InstaFlights Search
First I use the citypairs lookup to show city pairs, then use them for the instasearch,
The problem is unlike I use NY or London (there were 2 other cities working fine), for almost ALL other cities, Im getting no response.
I know data is limited but since the citypairs api already returns VERY limited data, but is it really THAT limited? Feeling like I must be doing something wrong because I cannot image, that api to work (in dev) only for 3 cities on 3 different dates :-/
destination api
here I use first the supported cities api, then use results to use the multi airports api, then use that for destination api.
Again, same here, only 2/3 cities actually work. Since in the destination api, UNLIKE the instaflights api, the changes of 'matches' are higher as any destination could be shown for the picked origin. HERE AGAIN almost no results, BUT for about 3 cities.
If anyone who has some experience with sabre, could help out it would be great- just trying to figure out if its me whos using it wrong or no. Thanks!
Can you please provide the city pairs that seem to be failing for you? I just did a test of both APIs (InstaFlights and DestinationFinder) and was able to obtain results with the city pairs provided there. I changed the point of sale to FR and obtained PAR-ATH, and that worked. Also worked with ABE-MCO which is the first city pair I obtain when using POS US.
The testing environment for this API but you should be not limited to just three cities.
I am trying to get the distance traveled on a transit route -- particularly San Francisco MUNI, but the standards NextBus, GTFS, and Google Maps API appear to be universal. I'm comfortable using any of these APIs, I'm just not sure how to go about this problem.
The easy way - ask Google Maps (this using webservices, but there is also the javascript API):
http://maps.googleapis.com/maps/api/directions/json?origin=37.7954199,-122.397&destination=37.7873299,-122.44691&sensor=false&mode=transit&departure_time=1348109609&alternatives=true
this JSON includes distance traveled, but there are two issues:
Google does not allow you to use this data unless you're displaying a map, which I don't want to do
I would need to ensure that the distance returned is for the correct route/line, since it can/will give multiple routing options. This is probably doable but would require more logic.
EDIT: using alternatives=true (or provideRouteAlternatives: true using the javascript API) only returns a maximum of 3 routes, which here in SF often doesn't include the route I'm looking for (other transit agencies, multiple lines on the same route, etc). So this isn't such a great option.
NextBus:
example route config:
http://webservices.nextbus.com/service/publicXMLFeed?command=routeConfig&a=sf-muni&r=1
The coordinates for each stop are given, but connecting the dots on those is not the same as the route taken -- it will cut corners, etc, and I need this to be accurate. The actual route taken is given under <path>/<point>, but I don't see any obvious correlation between stop and path coordinates. Plus, NextBus says in their documentation (p.10 near the bottom) that you should NOT connect points between <path> segments, they're only meant for drawing on a map and can overlap.
GTFS:
The GTFS data also separates stop and "shape" coordinates (like NextBus paths). Unfortunately, the coordinates are slightly different for the same stops between NextBus and GTFS (rounding), though the stop ID/tags are the same. Also, the data files are in the megabytes, and I need to use this for a mobile app. I suppose I could put all the data in a database and query that, but that still leaves figuring out how to correlate the stops with the shape. The "shapes_distance_traveled" column in the shapes.txt file is especially promising. MUNI chooses to leave the optional "shapes_distance_traveled" field out of stop_times.txt, though.
Any advice would be appreciated, I understand this seems like an epic task to get a simple value. Maybe I'll just throw a map in to legitimately use the distance :)
Instead of using Google Maps, I would look into the un-encumbered licensing of OpenStreetMap. There are multiple
routing engines that can use OSM data. Personally, I would use routing in PostGIS or SQLite, but depending on your skillset you might choose another.
You've clearly done your research, (+1), and as you said, the easy way is to ask Google. If it is worth for you then you might want to look into purchasing a business licence to use the Google Maps API, and negotiate with them about the requirement of displaying a map. That's the only legal way I can think of with the Google API. Alternatively, you can try building you own routing engine with data from the TIGER data set, which is freely available from the US Census Bureau, but again, as you said, it may seem like an epic task. :-)
I am using Google Maps API v3 Distance. It has worked well for the majority of the addresses in my database. However, it seems like some addresses just aren't available in Google Maps, and it seems to pick the closest street address match which could be way off. I would expect Google Maps in this case to provide an answer based on city and zip. Does anyone have a solution? I've thought of double checking mathematically by geocode and checking Yahoo maps(or other sites) for the ones that are way off but that adds processing time and is not a very elegant solution. There must be some setting I'm missing or other such work around.
Thanks!
BTW shout out to the new Json Serializer! Well it was new to me anyways.
How are you formatting the address you are sending ?
I've used the Google Maps API to do some reverse geocoding and if a street could not be found (due to a typo or what have you) Google would return the lat lng for the historic town center.
I structured addresses as Country, city cityzip, street nr.
You should use the location_type of the geometry object to determine what accuracy was returned. I suggest checking to see if the returned resulsts indicate whether a result is anything other than ROOFTOP or RANGE_INTERPOLATED.