MKergall / osmbonuspack

A third-party library of (very) useful additional objects for osmdroid
GNU Lesser General Public License v3.0
604 stars 205 forks source link

position marker following the route(polyline) like google maps #432

Open Ostreey opened 1 year ago

Ostreey commented 1 year ago

Hi! MKergall thank you very much for this greate library. Curently im creating navigation app with speedcameras detection. I have most of the stuff already working i have few question regarding improving user experiance.

  1. When in google maps you set the road, somehow position marker is following exactly the route (polyline), it seems like some kind of snap algorythm. Is there something like this implemented in osmdroid/osmbonuspack ? If not could you give me some guidelines how to do it ?
  2. I'm using animateTo() to follow current location and move the map, position marker is just static imageView on the map. It works fairly good, although it has an effect of - animating to next gps location, stoping for half of second and animating again to new gps location. I would like to remove that effect of stopping for short period of time by increasing animation lenght, unfortunatelly parameter 'animation lenght' in animateTo() doesnt do the trick. Seems like at some point current position is just stopping to move and loosing real position. I did animated marker which is moving on the map following next gps position and it works good, i could do the same with setCenter, setMapRotation but maybe i'm just doing something wrong with animateTo?

Thank you very much

eclectice commented 1 year ago

See OsmDroid demo app's 10K race in Paris under the Data section at play.google.com/store/apps/details?id=org.osmdroid. The source code for the demo can be found here https://github.com/osmdroid/osmdroid/blob/master/OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/SampleRace.java

https://www.youtube.com/shorts/nl3AB052_tE

Ostreey commented 1 year ago

This is great. thanks

Ostreey commented 1 year ago

See OsmDroid demo app's 10K race in Paris under the Data section at play.google.com/store/apps/details?id=org.osmdroid. The source code for the demo can be found here https://github.com/osmdroid/osmdroid/blob/master/OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/SampleRace.java

https://www.youtube.com/shorts/nl3AB052_tE

So I'm following examples in order to make border color around roadoverlay. I got it to work but since its two paints above each other if my roadOverlay is long (has many Geopoints) it's making app laggy. Is there any workaround available ? Thanks

MKergall commented 1 year ago

you can simplify your route with the DouglasPeucker reducer (PointReducer class).

Ostreey commented 1 year ago

Thank you, it helped. Another question. I'm using custom tiles generated in mobac (.sqlite). It's entire map of country - weight 27GB divided into 12 files. Although tiles are loading slower than the one using internet directly (from cache) from OSM tile server. Files are inside of device internal memory. When im using animate to from lower zoom to (10) to lower zoom (18) mostly after zoom i get white screen and tiles are slowly loading one by one (around 3 seconds loading time ). Is it normal ? I'm using this for offline tiles. map.setTileSource((new XYTileSource( "Ecuador", 6, 19, 256, ".png", new String[] {} )));

Is it possible to archive following effect: When using animateTo while zooming in - tiles from lower level stays on the screen and new tiles are beeing loaded on top of them ? This would atleast remove ugly effect of white squares

xdindincx commented 1 year ago

Hi! @Ostreey

Can you please tell me how you were able to animate/move the marker along the polyline generated between 2 geopoints? I have looked into the 10K Race in Paris example but I am not quite getting it.

Thanks!