OSMDroid Points of interest using multiple facilities - android

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.

Related

How to get the shape of a lake with the HERE-API

I'm building a rowing-related Android app with the here-api and would like to compute the (closest) distance to the shoreline to warn a rower if he is too close (which is not allowed on some lakes). I found a way to get the are for cities or postalcode but not for a location (with "LocationType": "lake").
Here obviously has this data, but is there a way to get it from them?
Sorry for the confusion.
HERE-API supports that shape data.
please see below documents.
https://developer.here.com/documentation/platform-data/topics/resource-layers.html
Below request will list layers.
https://pde.api.here.com/1/doc/layers.html?app_id={{app_id}}&app_code={{app_code}}
And there is some layers you are interested in
especially Layers CARTO_POLY_DO1 to CARTO_POLY_DO5 have polygon shape data.
Also below request list the detail information of the layer.
https://pde.api.here.com/1/doc/layer.html?layer=CARTO_POLY_DO3&app_id={{app_id}}&app_code={{app_code}}
I hope this help!

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.

Can alternate routes be set up with different viapoints?

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

Quadtree on android maps utils

I'm developing a android application with google maps v2 that draw polygons on the google maps. But now i have to identify a click on a certain polygon and popup a window.
I found this useful library on github
This library has the method containsLocation implemented. This method receives a LatLng (from click on the map) and a List (the polygon). This is fine but if i have 1 million polygon in the map i cant iterate all and test if a certain LatLng belongs to a certain Polygon. I remember that i can use a quadtree to get more performance and this library also implements a quadtree but it uses point. What is the best way of doing this? May i have to reimplement this quadtree for a quadtree of LatLng ? Or in each click i have to convert this click to a point and search on a point quadtree?
Regards
you cannot use a Point- Quadtree, you need an Object-Quadtree for your Polygons. An object quadree uses the bounding box of the polygon or any object for adding into the tree.
you dont need to consider latLong, use x,y with x= longitude, and y = Latitude.
Consider reading Hanan Sammet: Foundations of multidimensional data structures.
I think you need to implement a quadtree that stores the polygons, then query the tree to see which polygon (if any) contains the LatLng. If you search around I'm sure you can find a decent implementation.

Drawing an elevation profile between two markers in Maps API V2

I'm a novice so I apologize in advance if my code and/or understanding is simplistic. I am attempting to build an app that allows me to select different markers and show not only the distance to the selected marker from my current location, but an elevation profile as well. I saw something similar to this in a Google Labs option for Maps where it allowed you to draw a line between two points and then it would give you a graph that showed the elevations between those two points. I've tried to find some answers here, but it seems nobody is really talking about this at all so I thought I'd ask. The code I'm currently using to give me the distance is:
if (marker.equals(windy))
{
//handle click here
WINDYINFO.setVisibility(View.VISIBLE);
float[] results = new float[1];
Location.distanceBetween(myPosition.latitude, myPosition.longitude,
WDY.latitude, WDY.longitude, results);
TextView distanceView = (TextView) findViewById(R.id.windydistance);
results[0] *= 0.000621371192;
distanceView.setText(String.valueOf(results[0]));
}
myPosition will always be my location according to GPS, and WDY is the elevation for the windy marker. How would I go about doing what I mentioned above, here, so that I can take the data and display it in my activity?
You are looking for Evelation API from Google. Take a look at the chart at the bottom of this page.

Categories

Resources