google maps - wrong (different) routes directions - google-maps-api-3

I try to get the instructions of a route direction from two points, but the route appears different when I give the coordinates through the source code (coorect route), than when the function gets them from the textbox. I want you to know that I am interested in finding the route only by the coordinates and not by the address
Thank you in advance
form source code (correct route) - http://www.touchsmart.gr/stackoverflow_map/route_from_variable.html
from textbox (wrong route) - http://www.touchsmart.gr/stackoverflow_map/route_from_text.html

Those are two different things. The correct route is passing in google.map.LatLng objects, the incorrect route is not. To use geographic coordinates you need to pass in google.map.LatLng objects, otherwise the coordinates get geocoded.
destination LatLng|string Location of destination. This can be specified as either a string to be geocoded or a LatLng. Required.
origin LatLng|string Location of origin. This can be specified as either a string to be geocoded or a LatLng. Required.
See this question for how to convert a comma separated string to a google.maps.LatLng object.

Related

LinkId Not found but returned by calculateroute.json

I'm trying to avoid a linkId with here calculateroute.json (7.2), mode pedestrian, but i receive an ApplicationError => subtype => "LinkIdNotFound"
The problem is, when i verify if the linkId exists (call same endpoint calculateroute.json with same params exceipt avoidLinks and who start and destination are two point coordinates on my linkId), here returns the same LinkId in response.
In clear, linkId exists in route response when call coordinates everywhere on the linkid without avoid, but not exists if i try to avoid this link on any route.
What i'm wrong ?
LinkId is -4294967295, but i have others with same problem
Call of a route with coordinates inside the linkid
https://route.api.here.com/routing/7.2/calculateroute.json?app_id={your_id}&app_code={your_code}&resolution=300&representation=navigation&linkAttributes=shape&mode=fastest;pedestrian;traffic:disabled&waypoint0=geo!43.607570,1.427560&waypoint1=geo!43.607570,1.427560&walkSpeed=1.2&language=fr
Call of a route at proximity of the linkid with avoid this link produce the error linkidnotfound
https://route.api.here.com/routing/7.2/calculateroute.json?app_id={your_id}&app_code={your_code}&resolution=300&representation=navigation&linkAttributes=shape&mode=fastest;pedestrian;traffic:disabled&waypoint0=geo!48.83842,2.39298&waypoint1=geo!48.85180,2.35666&walkSpeed=0.97&language=fr&avoidlinks=-4294967295
The route shape for the waypoints in 2nd API doesn't include the link ID that you are trying to avoid. you can find all linkID that forms this path first and check if the removal linkID is actually present or not. hence it is throwing the error.

How to get a startpoint, endpoint and distance of "boatFerry" segment in Here Routing API

I'm trying to get "boatFerry" segment (startpoint, endpoint, distance, etc.) from the calculated route response via Here Routing API. What parameters I should use in my request to get it?
There is no straight attribute or field to get only the boatFerry segment details in a route. However, you can get this by using the below query where link information is provided.Every link has flags. You can search for the flag of your interest (in the below example search for railFerry) and sum their lengths.This will give you the ferry length in your route distance.Also, it provides you the start and end points.
https://route.cit.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!stopOver!51.006511,2.321095&waypoint1=geo!stopOver!51.137062,0.911495&mode=fastest%3Bcar%3Btraffic%3Aenabled&app_id=xxx&app_code=yyy&representation=linkPaging&language=de-de&returnElevation=true&maneuverAttributes=position%2Clength%2CtravelTime%2CstartAngle&instructionFormat=text&routeAttributes=waypoints%2Csummary

Documentation for Google maps MarkerImage url string in constructor

The first argument of the google.maps.MarkerImage class constructor is a url string with several GET variables.
This is an example of the url string in use. The color variable is clear, but what do the other variables do?
Yes, what Trott says. Basically the markerimage URL is a relative or absolute url to an image, nothing more or less. So depending on where you get your images from, it might have a querystring on it (e.g. if the marker is to be dynamically generated by a server-side script). So in this case you just happen to be using the Charts API to get a dynamic image for your marker.
The first argument is not necessarily a URL string with several GET parameters. It is simply a URL string. Google Maps API uses that URL to retrieve the image. If there are GET parameters, they are used (or ignored) by the server from which the image is being retrieved.
The example you link to contains a URL using Google's Charts API. The definitions for the parameters are at http://code.google.com/apis/chart/image/docs/chart_params.html.

Raw, unprocessed URL with ASP.NET Routing

I'm using ASP.NET UrlRoutingModule directly (not through MVC) to map certain routes to their handlers:
RouteTable.Routes.Add(new Route("products/{name}", handler));
Then, at request time, I'm getting the values from each route:
RouteData routeData = HttpContext.Current.Request.RequestContext.RouteData;
routeData.Values.TryGetValue("name", out value);
Everything fine so far, I'm getting the proper values for each route. My problem is encoding: I want to get the raw value of a route data. Example: for the route above, if the requested URL is http://example.com/products/word%2Dword the resulted "name" is "word-word". What I want though is the exact value "word%2Dword".
I know that with ASP.NET I can get the raw unprocessed URL using Request.ServerVariables["HTTP_URL"] but unfortunately I cannot use this here.
Any help would be appreciated.
Thanks
EDIT
My specific problem is that I would like to get more products in a single request using their names. I have for example the following product names: "student,pupil" and "sick,ill" (their name contains a comma). I'm also using a comma to separate names in the request.
I handle the encoding on the client side so the GET request looks like this: http://example.com/products/student%2Cpupil,sick%2Cill (I'm encoding each name separately but I'm not encoding the separator).
On the server side the "name" parameter will be automatically decoded by ASP.NET and the result is: "student,pupil,sick,ill" so now I don't know which is the separator. Request.ServerVariables["HTTP_URL"] returns the URL as I want it ("products/student%2Cpupil,sick%2Cill") so I suppose there has to be a way to get the raw value as a route data.
The "raw value" you're seeing isn't actually the original value, it's what was encoded to make the URL safe for the HTTP Protocol.
http://example.com/products/word%2Dword for instance started out as http://example.com/products/word-word and is turned back into word-word as it comes out of the HTTP transport layer.
If you pass it through Server.URLEncode you will get back the same encoded value (%2D instead of -) - but if you can't use Server variables, are you going to have access to the Server object?

QUrl Class's *addQueryItem* method

I want to query the Google map for all the roads leading to a given GPS coordinate.
For that I'll have to place a "query" which can be done by: http://doc.qt.io/qt-4.8/qurl.html#addQueryItem
Now I want to know how to figure out that what should be the key and its corresponding value here?
Should the key be "road"/"roads"? Whats the way to decide that? And I want all the roads not a particular one!
Any hints?
An HTTP URL has the following format:
http://some/address?key=value&more=values
The part behind the '?' is your query. You have to determine how the resulting URL should look like and add key/value pairs accordingly.
It isn't completely clear to me what you want to accomplish. You might want to check out these Google Maps API Links:
http://code.google.com/intl/de/apis/maps/documentation/staticmaps/#Addresses
http://code.google.com/intl/de/apis/maps/index.html

Resources