According to this solution
Why retrieving Google Directions for Android using KML data is not working anymore?
I've got the question what is the shortest way to draw the route through the waypoints.
Implement itemizedRouteOverlay to store routes route from
start point->waypoint1, waypoint1->waypoint2, waypoint2->destination
Merge route objects and draw it as routeOverlay
Route1=start->waypoint1, route2=waypoint1->waypoint2 etc..
Add implementation of waypoints in parser
Any other, better way?
Any hints will be appreciated.
The fastest way I found is to:
add parameter waypoint with via: prefix for each waypoint to JSON URL string, so it doesn't create more than one leg in JSON (crucial part because there is only one leg support in GoogleParser provided with that example). Google offers only 8 waypoints support for non buisnes customers, so that was another problem. I've managed to bypass it by spliting route to sub-routes, where ending point of one route, was begining point of another route. Each route was stored in list as different routeOverlay object, and then one-by-one added to mapView in the loop .
Related
i create a supply chain model in anylogic
that have a distributor and 8 trailer and 5 trucks for Transport Order from distributor to retailers.
now anylogic routing are Automatic but i want to write the agents(trucks) that They can choose their own road.
what should I do?
grateful
In order to move an agent along the given route, you need to create a Route Provider by code and set it as route provider for the agent.
The code sample can be found in the following example model: https://www.dropbox.com/s/o5w2bw6cn9l8ez8/DynamicRoutes.alp?dl=0
You can specify any route drawn on the GIS map as argument of the function "getCustomRouteProvider()".
One important comment to the example model: when the initial location or target for an agent is defined as GIS Point of a network, the agent uses the shortest (fastest) route of the network to reach the destination.
In order the agent follows the route specified while creating the custom route provider instead of, the agent is initially placed in the point defined by the latitude and longitude of the "gisPointStart" and moved to the point with coordinates (gisPointEnd.getLatitude(), gisPointEnd.getLongitude()).
Using the GIS map, you can only make trucks use specific roads by defining separate waypoints (=GIS points) that force your trucks to use route A or B.
I am new to android development but familiar with java. I want to send a request (containing coordinates of locations) to google maps api for distance matrix and later calculate the sum of distances for each point. The response from api is either in javascript or xml (i dont really know which one). How do i send the query in java and how do i extract the distances from the response?
Try using seperate classes to send and recieve data through the Google maps API. try using JSON to send aaplication data.
In order to use any thing like this (or that is owned by google etc.. ) You first need to setup a developer account at https://play.google.com/apps/publish/signup/
It does cost 25 dollars but in all honesty it's worth it as you get access to a lot of different things including the google maps api, if you're not interested in spending the $25 I would suggest looking into an alternative mapping api.
If on the other hand you will spend the money they've got some great tutorials laid out in the documentation!
A Google Maps Distance Matrix API request takes the following form:
https://maps.googleapis.com/maps/api/distancematrix/output?parameters
If you need more information, Refer to "Distance Matrix Requests".
https://developers.google.com/maps/documentation/distance-matrix/intro#DistanceMatrixRequests
You can also use the "getDistanceMatrix" that issues a distance matrix request.
https://developers.google.com/maps/documentation/javascript/3.exp/reference#DistanceMatrixService
I am writing a program in Java that creates multiple destination points (latitude,longitude).
And I wish to add each destination as a marker on Google Maps.
The problem is, Google Maps doesn't allow more than 25 markers at a time.
At the moment I use I am creating a a URL string to represent the map, this is an example:
String url = "http://maps.google.com/maps?saddr=33.542550,-112.071399&daddr=33.538090,-112.047250+to:33.523892,-112.093669";
and then I call
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
to open google maps with 3 markers present.
When my string includes more than 25 destination points, it does not work since Google maps does not allow it.
Are there any ways around this? and possible make 50 markers in one map?
Create your own map with the Google Maps Javascript API that supports as many markers as you want. Beware however of URL length limitations.
Another option would be to create a KML file containing your markers with a unique name and use that to display the markers.
I have a page where the user enters the starting point and ending point and I show de route in the map. I would like to know how to get this polygon (polyline) and save it in Postgis through the Java / Hibernate.
Someone can help me?
Thanks.
Luciano
Usually you cannot get that polyline as vector data coordinates, because these data are provided either by Teleatlas / Tomtom (via Google service) or Microsoft Bing (Navteq data) or Nokia (Navteq data)
Such vector data are extremly expensive, and therfore you can only request that a line is drawn on the screen, but you will not get the geographical coordinates (latitude, longitude). Even Google would not have the right to give you that vector data (because they dont own that data, they only display it).
However, I remeber a post here showing how to use an unofficial Google server where you can request the route between two geo points, and get back a compressed encoded route.
But you legally cannot use that service, nor I do know if it yet exists.
An alternative would be use open source map data, like OpenStreetMap, for these services you can get the vector data for a route. For example: the ios RouteMe library provides such things via OpenStreetMap.
Is it possible to find the nearest bus, train, or other public transit?
The 'nearest' is a separate case, but is it just possible to find them?
They are tagged, but I want to know how to access/find them.
I don't think that this is supported in Google Maps yet, finding the nearby public transport locations of a spot.
The only workaround I could think of is to use the location you want to get the nearest public transportation as a starting point of a directions calculation.
As the destination, you choose any random location that's a little away but far enough so the route would require a public transportation (not just walking).
Then you could fetch the first public transportation from the resulting data.
For example:
if you have calculated a route like this:
http://maps.google.com/maps?f=d&source=s_d&saddr=15+Vanderbilt+Avenue,+New+York,+NY+10017+(Grand+Central+Terminal)&daddr=central+park&hl=en&geocode=CUdYBSaiyFjNFWbXbQIdIDOX-yFZWQrti_yyniknhhaRAVnCiTHFY7RT82_HCg%3BFT0ebgIdVT6X-yn1xwsBmljCiTG2GSD9L5ZZwQ&mra=pe&mrcr=0&dirflg=r&ttype=dep&date=06%2F22%2F10&time=10:34am&noexp=0&noal=0&sort=&sll=40.764379,-73.974187&sspn=0.093872,0.154324&ie=UTF8&z=15&start=0
you would just add the parameter &output=json to the url and could fetch the data as json format.
http://maps.google.com/maps?f=d&source=s_d&saddr=15+Vanderbilt+Avenue,+New+York,+NY+10017+(Grand+Central+Terminal)&daddr=central+park&hl=en&geocode=CUdYBSaiyFjNFWbXbQIdIDOX-yFZWQrti_yyniknhhaRAVnCiTHFY7RT82_HCg%3BFT0ebgIdVT6X-yn1xwsBmljCiTG2GSD9L5ZZwQ&mra=pe&mrcr=0&dirflg=r&ttype=dep&date=06%2F22%2F10&time=10:34am&noexp=0&noal=0&sort=&sll=40.764379,-73.974187&sspn=0.093872,0.154324&ie=UTF8&z=15&start=0&output=json
In this sample you would get "Bus M02" as the first public transportation.
But this is really a very bad workaround. I think gotta wait until Google opens the API for that.