Can alternate routes be set up with different viapoints? - android

I am trying to create 3 alternate routes, as in the demo project. After the routes are calculated, I would like to insert different SKViaPoints along each route. Is this possible? SKViaPoint only seems editable at the SKRouteManager level, which would give all alternate routes the same via points.
Thanks in advance.

This is not supported - the alternative routes will use the same start, destination and via points as the original route. You can change the routing constraints used for alternatives but not the start/end/viaPoints.
If you need to calculate multiple routes with different settings, call the calculate route API with "setRouteExposed" to false

Related

OSMDroid Points of interest using multiple facilities

I am using OSMDroid with its bonus pack to display a map and get point of interest near a location, but I can't find a way to get POI of different type in once.
As indicated in the documentation I am using the function getPOICloseTo() but it doesn't seem to handle a null facility to return all types of POI.
val poiProvider = NominatimPOIProvider("OSMBonusPackTutoUserAgent")
val pois = poiProvider.getPOICloseTo( GeoPoint( geoPoint ), "cinema", 10, 0.1 )
If there is a way to avoid making one call per POI type I would like to know it !
Thanks in advance, have a nice day
I don't think you can do that with Nominatim service. You can dig in Nominatim API doc (having a look at Special Phrases).
Alternative: move to OverpassAPIProvider. A little bit complex, but super-powerful. I'm quite sure it will match your need.

How to filter markers in Mapbox Sdk

I'm creating an Android app using MapBox. I've already set up a simple map functionality with markers sourced from .json file. Next step is filtering the markers on the map, just like in this gl-js example here:
https://docs.mapbox.com/mapbox-gl-js/example/filter-markers/
I can't find any sdk examples anywhere, and since this is my first app I really can't figure it out on my own. Any help will be appreciated.
You can check out this example https://docs.mapbox.com/android/maps/examples/multiple-expressions-temperature-change/ that features two layers that fetch a min or max temperature from the data source and display it.
The filtering part is done here:
// Only display Maximum Temperature in this layer
maxTempLayer.setFilter(eq(get("element"), literal("All-Time Maximum Temperature")));
loadedMapStyle.addLayer(maxTempLayer);
Filters accept expressions as arguments, and here Expression.eq is used to compare "element" from the GeoJSON data source (referenced with the Expression.get) with the "All-Time Maximum Temperature" value. If it resolves to true, the feature is going to be displayed, otherwise, it's going to be hidden.

Avoid specific point in android map

I have an issue with android Google Maps. I want find route between two locations but avoid specific points which given in input.
Can you help me with this ?
There is no specific feature of this kind yet. According to this SO thread, this is a feature request for the Maps API.
However,I can suggest possible alternatives like Using Waypoints in Routes.
Note: sample was done in Javascript
In this fiddle demo, you have 3 markers A, B & C.
A = origin, B = route, C = destination.
var directionsService = new google.maps.DirectionsService;
Let's say the initial point of B is blocked, drag it to other streets/points in the map (zoom-in to see other routes) and you have your alternative route. You can read more of waypoints in the DirectionService guide.

SkMaps Remove SKPolylines

Currently I am removing SKPolylines by tracking their setIdentifier(int) numbers when I create them, and then when I delete them I apply a new polyline to the map with the same identifier that is transparent. I have two issues with this:
I assume there should be a way to do mapView.removePolyline(int identifier); or mapView.removeAllPolylines();
I also assume there should be a way to do mapView.getAllPolylines() that returns a List<SKPolyine> because that is possible with POI's and annotations. At the very least mapView.getNumPolylines(); that returns the number of polylines so that I can delete them all with my original method, without having to track how many I have put down.
My question is: Am I missing either functionality described in 1/2? If those functionalities do not exist then is there a better way than my current method?

Issue in passing multiple way points to Google map API

I am trying to pass multiple way points between an origin and destination, so that when I get the response I can draw the route on Google map.
This is a sample call I make (in my original API call, there are more way points):
https://maps.googleapis.com/maps/api/directions/json?origin=41.3758887,2.1745799999999917&waypoints=41.39097711845494,2.1807326361331434&41.38680260504134,2.188132850805232&41.38458293055814,2.1758925899657697&destination=41.38394800519846,2.166872321048686&sensor=true&mode=walking
Is the above format right for passing multiple way points?
The main issue I am facing is that the route is not going through all the way points I am passing.
I am always getting a "waypoint_order" : [ 0 ].
use '%7C' instead of '&' in your waypoint request. i.e.
https://maps.googleapis.com/maps/api/directions/json?origin=41.3758887,2.1745799999999917&waypoints=41.39097711845494,2.1807326361331434%7C41.38680260504134,2.188132850805232%7C41.38458293055814,2.1758925899657697&destination=41.38394800519846,2.166872321048686&sensor=true&mode=walking

Categories

Resources