Offline routing library that can go along with osmdroid - java

I have a tracking application and uses osmdroid library. My prolbem is that osmrdroid does not support routing. By the way the application is purely offline. Are there any suggestions that you can provide with regards to a library that supports routing, which can coordinate with the osmdroid map overlay. What I need to do is only calculate shortest path and draw it on the offline map from one point to the next.
I found this link:
http://code.google.com/p/j2memaprouteprovider/source/browse/trunk/J2MEMapRouteAndroidEx/src/org/ci/geo/route/android/MapRouteActivity.java
but I don't know how to integrate it on osmdroid application.

I think in all osmdroid apps the map data come from a code line like this:
map.setTileSource(TileSourceFactory.MAPQUESTOSM);
This means the maps are downloaded as raster tiles, or if you have an offline application the maps are cached as tiles. So you do not have a graph of streets that could be used to calculate a route. So routing isn't supported in osmdroid for a reason.
To do offline route calculation you will need the street network data on your phone. Then you can use a simple wayfinding algorithm to calculate the shortest path. (like Dijkstra)

Related

Osmdroid as alternative to Mapbox

I am currently using MapBox SDK to display raster map tiles within an Java/Kotlin implemented Android app. However, I want to replace the Mapbox SDK with an alternative primarily because, as far as I understand, when I use MapBox SDK in my app even just to display other third party map tiles, it will result in some location information about my user's being intermittently sent to Mapbox. I am now considering osmdroid and was looking for some input on whether this will be an appropriate alternative. I am using Here maps as the primary source of raster map tiles [though I also have limited coverage map tile server (generated from OSM) of my own which I do not currently use but might as an alternative if needed]. Within the app, the functionality that I want to implement is relatively simple:
(1) Display map tiles based on standard X,Y,Z system
(2) Display tap-able icons overlaid at certain (GPS) locations on the displayed maps
(3) Allow user to zoom in-out or scroll across the displayed map
However, one absolute key requirement is that none of my user location information will be shared as part of the terms of usage for the SDK.
Is Osmdroid SDK a possible suitable alternative to mapbox SDK for this ?
Thanks for any comments.
Since 2017, I've been using the OsmDroid SDK quite frequently. The SDK is primarily used to create my situational awareness map application and to manage my offline GeoPackage raster and vector map collections via OsmDroid GeoPackage API support, though the core GeoPackage API allows me to use online GeoPackage-based map providers.
To respond to your inquiry: No user data, including location, is stored by the OsmDroid APIs. It is merely an SDK for manipulating its MapView (which extends from Android's ViewGroup) and supports loading tile sources from online/offline map databases.
It will be our responsibility to implement our own location positioning codes so that any user position, in addition to other map objects you want to include in the map, can be drawn on the map.
Unlike the Google Maps SDK, no API key is required for the OsmDroid SDK. In fact, it attempts to emulate what the Google Maps SDK can do while remaining royalty-free and open-source license compliant. It primarily serves OpenStreetMap purposes. To improve the OsmDroid experience, a free OsmBonusPack SDK simplifies application use-cases.
https://github.com/MKergall/osmbonuspack
Except that you'll need a TOKEN/API key from the map database provider of your choice for any non-free map databases you want to use as base maps or tile sources. This requires you to code in the necessary parameters for the tile module provider to work.
https://github.com/osmdroid/osmdroid/wiki/Map-Sources

Getting location of a direction of current location in Android

I want to implement a function that calculates locations' list (longitudes and latitudes) through a direction of my phone. The result can be a rectengular shape which is pointing the corners as locations.
First how can i find the device current direction which means which direction the back camera points ?
Then how can i obtain a list of location information through this direction ?
Thank you
From the documentation of Google Maps Android API, the location data available to an Android device includes the current location of the device pinpointed using a combination of technologies - the direction and method of movement, and whether the device has moved across a predefined geographical boundary, or geofence.
This is the 3 options that you can do with your app.
Using My Location layer that provides a simple way to display the device's location on the map. It does not provide data.
Using Google Play services Location API is
recommended for all programmatic requests for location data.
And using the LocationSource
interface allows you to provide a custom location provider.
By using this, you can also get the different information about the
coordinates that you get
For more information, check this tutorial:
Google Map Tutorial in Android Studio: How to get current location in Android Google Map
Google Map Tutorial in Android Studio

Best path googleMaps

I need to create an application that identifies the best path for a person. But it would need to identify the importance of uphill and downhill on the way.
How getting this information of which path would be straight?
This app is for android.
Tanks!
Check out Elevation API
and Distance Matrix API
The distance API may be the only thing you need.
Route information would be obtained by the Directions API
A combination between the 3 may be somewhat necessary, but once you setup an HttpClient to the google server you can just create back-end web service calls to grab the information you need on your android phone.

Android Project - Required Tools

I'm in the process of starting a new Android project that will:
Display a Google map
Track and record users movements
Display the route on the map
Show local points on interest on the map
My question is what extra tools will I need to accomplish this? I can already get a basic Google Map working with zoom controls and place overlays etc. but my main concern is how I will track the users movements. I was thinking there maybe some sort of fleet management API but I really have no idea.
A link to some sort of tutorial would be great or even just to possible tools.
Use the class http://developer.android.com/reference/android/location/LocationManager.html to obtain the device geographical location
A Caltrans planning grant went towards creating an Android app called CycleTracks that does all of your bulleted items except the last one about points of interest.
You can download the source code here: http://www.sfcta.org/downloads/cycletracks/CycleTracks-android.zip
I haven't looked at the license to see how free you are to use it as a starting point, but I have to imagine it might be helpful just to be able to look at it even if the license is restrictive.
You can read more about it at http://www.sfcta.org/content/view/666/375.
You don't need any extra tools. Use the GPS or radio cells to get the location of the phone. This thread explains how you can get the location:
How do I get the current GPS location programmatically in Android?
If you want to Track the users movement you'll need to run a webservice on a server and have the app report the location of a user at regular intervals.
Be careful though, if you don't tell the user this is what you are doing, and provide an opt out, you could be pulled from the market pretty quickly.
Be sure you aren't recording any sensitive information as well. Usually position, phone type and OS type is allowed but much more could get you in trouble.

create an application which can track the location using open street maps

I am planning to create an application which can track the location of a certain person using open street maps. But I don't know where to start.
Have a look at the sourcecode of osmdroid, an opensource reimplementation of google's maps app using openstreetmap. They even provide a jar you can use! Should get you up to speed in no time. And possibly the official documentation on Location & Maps...

Categories