1 (edited by elhowdy 2019-02-20 10:57:05)

Topic: Offline Navigation

Hi there,

For an App (Android and iOS) I need navigation and a working GPS in a specified area, but it has to work offline, as the main target-group are tourists.
What is the best way to prepare a certain area of the world to work and navigate through while being offline using "Online Maps v3"? I've read somewhere on the forums that its possible to pre-load the maps to work offline, but i havent read anything about the navigation part yet...

Sorry if that has been asked and cleared up before, but i couldnt find it in the docs or in the forum.

Cheers and thanks upfront,
Alex

Re: Offline Navigation

Hello.

It has never been discussed, and it does not have a prepared solution.

To make offline navigation you need to have an atlas of roads and a route search algorithm.

Algorithm:
As an algorithm, you can try using A-Star.
I do not know how this algorithm is suitable for this task.
But this is a universal algorithm and will definitely work until you find something better.

Offline road atlas:
I have never seen such data in public access.
So you have three ways:
1. Buy atlases from any service that has it. For example maps.me, tomtom, etc.
2. Unofficially use atlases for some other application or service. In this case, you will need to reverse engineer the data.
3. Make your own atlases based on public data, for example from OSM or Mapbox.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Offline Navigation

Thanks a lot for your suggestions and your fast reply!

Alex Vertax wrote:

As an algorithm, you can try using A-Star.
I do not know how this algorithm is suitable for this task.

I think the A-Star algorithm could work quite fine (since the tourists are not driving around in cars, we dont have to consider one-way-streets).

Alex Vertax wrote:

Offline road atlas:
I have never seen such data in public access.

Hmm, so what exactly is the "offline maps" feature then of the asset "Online Maps v3"? I'm a bit confused - is there a difference between a "road atlas" and a "map"?

I was thinking, that if your asset doesnt support offline navigation out of the box - i might have to do this myself using A-Star, but somehow i need to visually connect it to the offline maps displayed by "Online Maps v3"?

Cheers and thanks for your help!

Re: Offline Navigation

Online Maps can display offline maps.
This includes: tiles, overlay, elevations, drawing API, markers, buildings.

Geocoding, routing, places search (etc.) are used by third-party online services from Google, Bing Maps, HERE, OSM.
Request to the service can not be offline.
Of course, you can cache the response, but it does not make sense.

Tile is just a picture used to display a map.
It does not contain information about objects.
So you can not use tiles to search for routes.
To do this you need an extra information, in this case the road atlas.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

5 (edited by elhowdy 2019-02-20 14:59:57)

Re: Offline Navigation

Hmm okay. That makes sense - I think i'm starting to understand how this works. Thanks for elaborating!

Alex Vertax wrote:

Tile is just a picture used to display a map.
It does not contain information about objects.

So i could store the MAP(Tiles) of a city offline and scroll through them and show the users location with "Online Maps"?
Correct me if i'm wrong, but there must be some data stored with the picture that connects the image to the GPS-Locations?
Lets say i want to place a Marker (some sightseeing POI for the tourist to see) on an offline map on location [x=200, y=50] (some lat long values) - is that possible?

If that is possible, i could also hand-place some navigation-nodes (for AStar) through the streets, where i want the user to be navigated through via latlong coordinates. (Perhaps it would be easier if i could match a navmesh with the map somehow?).

Also, i guess the drawing API could be used to show generated path then?

What do you think?

Thanks a lot for your help here - perhaps some other user might benefit from this conversation as well.

Cheers,
Alex

Re: Offline Navigation

You need to store the tiles and explain to the map where to find them.
Most likely you will keep the tiles outside the Resources, so here are some examples:
http://infinity-code.com/atlas/online-m … %20Request
For Resources, you can simply select the source of the tiles in the inspector.
Online Maps will automatically load only the required tiles and display them on the map.

How does the tile system work:
https://docs.microsoft.com/en-us/bingma … ile-system
https://www.maptiler.com/google-maps-co … rojection/

Yes, of course you can place a marker in some location.
But for this, it’s does not matter for the map how tiles look and if they exist at all.

Yes, you can use navmesh.
See "4_sliding_window_infinite" example scene from NavMesh repository.
https://github.com/Unity-Technologies/N … les/Scenes

Yes, you will need to use drawing API.
Examples:
http://infinity-code.com/atlas/online-m … wing%20API

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

7 (edited by elhowdy 2019-02-21 10:52:29)

Re: Offline Navigation

Hi Alex,

Thanks for your links! They helped a lot! I decided to purchase the Asset yesterday because of your dedicated support! smile

By now i managed to download some tiles and load them into Online Maps via Resources. The offline-loading works really nice!

For the navigation part - i had a look at the navmesh example that you posted. Unfortunatly, it seems to generate the navmesh "on the fly" - i would need a pre-built navmesh (a 3d gameobject) to work, because (as far as i know) i cant generate a road-navmesh based on the tiles texture. Also, the navmesh should be extending the borders of the view, because the user must be able to navigate to a location that he is not seeing at the moment on the map). I thought about pre-modelling the navmesh and then, attaching it to the map like a 3d marker.

I already managed to attach a 3D marker, but unfortunatly (in my use-case) the marker disappears as soon as he is out of sight. that makes sense for markers of course, but not if i need it to stay for pathfinding smile. do you have a suggestion how to tackle this issue? deactivating the "SetActive(false)" in CustomMarkerEngine.cs line 92 didnt do the trick. it would be nice if we could find a solution to this, as manually placing lat/long nodes on every street seems extremely daunting to me - simply modeling the streets would be a LOT faster....

Thanks a lot for your help!

Cheers,
Alex

PS: Also, i would need to figure out how to scale the marker with zoom level accordingly, but that should be doable with some specific ratio i guess...

Re: Offline Navigation

Use OnlineMapsMarker3D.checkMapBoundaries = false to make the marker is always active.
http://infinity-code.com/doxygen/online … bf394954f6

How to scale a marker with a map:
http://infinity-code.com/atlas/online-m … ample.html
For float zoom:
http://forum.infinity-code.com/viewtopi … 4529#p4529

If you have predefined points on the basis of which you will search for a route, why do you need navmesh?
You can directly use these points in the AStar algorithm to find a route.
When you have found a route, you can navigate the route this way:
http://infinity-code.com/atlas/online-m … ample.html

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Offline Navigation

Thanks again for the links! I'll check them out asap!

Alex Vertax wrote:

If you have predefined points on the basis of which you will search for a route, why do you need navmesh?

I think i explained it wrong - i only have predefined target points (Points of Interest), but the user can start the navigation from wherever he is. That makes it pretty much unpredictable.

My idea was to model the passable streets of the city as a navmesh and then, when the user requests a route, calculate this route through the navmesh and display it back to the user. Perhaps its not even necessary to match the navmesh with a 3D marker, but i would then need a way to match the lat/long positions on the map to the 3D-point positions of the navmesh.

Re: Offline Navigation

I did not correctly understand your point in post 5.

To convert coordinates to Unity World Position, use:
OnlineMapsControlBaseDynamicMesh.GetWorldPosition
http://infinity-code.com/doxygen/online … 6316068362

To convert Unity World Position to coordinates, use:
OnlineMapsTileSetControl.GetCoordsByWorldPosition
http://infinity-code.com/doxygen/online … 1b58011257

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!