Opened 3 years ago

Last modified 2 years ago

#1285 new enhancement/feature request

Android Rastermaps

Reported by: jandegr Owned by: cp15
Priority: major Milestone:
Component: port/android Version: git master
Severity: normal Keywords:
Cc: sebastian.leske@…

Description

It would be nice if we could use rastermaps on Android as we can on Linux using imlib2

Attachments (2)

AndroidRastermaps1.diff (8.7 KB) - added by jandegr 3 years ago.
map3.txt (4.2 KB) - added by jandegr 3 years ago.
A textfile map for 8 x 8 tiles with relative paths

Download all attachments as: .zip

Change History (13)

comment:1 Changed 3 years ago by jandegr

Attached a diff of a first attemp,

Last edited 3 years ago by jandegr (previous) (diff)

Changed 3 years ago by jandegr

comment:2 Changed 3 years ago by jandegr

A sample with a level 3 (8 x 8 tiles) map rendered with tilemill

https://dl.dropboxusercontent.com/u/93775123/Navit/Screenshot_2015-03-20-11-57-42.png

the tiles : https://dl.dropboxusercontent.com/u/93775123/Navit/3.zip Use with map3.txt, tests were done with layout car and the following entry in navit.xml

<itemgra item_types="image" order="0-4">
	<image/>
</itemgra>
Last edited 3 years ago by jandegr (previous) (diff)

Changed 3 years ago by jandegr

A textfile map for 8 x 8 tiles with relative paths

comment:3 Changed 3 years ago by jandegr

rastermaps with a little more detail are possible too, up to L5 it still works for the entire world but starting from L6 the map has to be reduced to a part of the world

a route and labels from the binfile, plotted on top of some L6 tiles : https://dl.dropboxusercontent.com/u/93775123/Navit/Screenshot_2015-03-20-17-31-00%5B1%5D.png

zooming in one step additionaly shows the major roads from the binfile: https://dl.dropboxusercontent.com/u/93775123/Navit/Screenshot_2015-03-20-17-31-23%5B1%5D.png

Zooming in one more level on my test setup makes the rastermap disappear and the screen switches to the classic binfile-only layout, but now with the smooth coastlines from #854.

Last edited 3 years ago by jandegr (previous) (diff)

comment:4 Changed 2 years ago by tryagain

Hi!

Looks very nice!

Can you change it to use existing draw_image_warp declaration, without significant performance impacts?

tryagain

comment:5 Changed 2 years ago by kazer

Trying to apply your patch on a fresh checkout :

$ wget http://trac.navit-project.org/raw-attachment/ticket/1285/AndroidRastermaps1.diff
$ patch -p0 < AndroidRastermaps1.diff
patching file android/src/org/navitproject/navit/NavitGraphics.java
patch: **** malformed patch at line 24:  import android.graphics.PointF;

Something is wrong. Your patch looks good tho. I spent a good 20 minutes trying to understand the issue, but didn’t solve it yet.

No big deal, I’ll rebuild the patch. I manually copy and paste every chunk in the unified format from trac ( instead of tabular ) and paste that into a file.

$ patch -p0 < 1285.patch
patching file android/src/org/navitproject/navit/NavitGraphics.java
Hunk #3 FAILED at 936.
Hunk #4 succeeded at 1005 with fuzz 1.
1 out of 4 hunks FAILED -- saving rejects to file android/src/org/navitproject/navit/NavitGraphics.java.rej
patching file graphics/android/graphics_android.c
Hunk #1 FAILED at 36.
Hunk #2 succeeded at 364 with fuzz 1.
Hunk #3 succeeded at 374 with fuzz 1.
Hunk #4 FAILED at 473.
Hunk #5 FAILED at 663.
Hunk #6 succeeded at 976 with fuzz 2.
3 out of 6 hunks FAILED -- saving rejects to file graphics/android/graphics_android.c.rej
patching file graphics.c
Hunk #1 FAILED at 727.
Hunk #2 FAILED at 2148.
Hunk #3 succeeded at 2969 with fuzz 2.
2 out of 3 hunks FAILED -- saving rejects to file graphics.c.rej
patching file graphics.h
Hunk #1 FAILED at 68.
1 out of 1 hunk FAILED -- saving rejects to file graphics.h.rej
patching file xslt/map_sdcard_navitmap_bin.xslt
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file xslt/map_sdcard_navitmap_bin.xslt.rej

Crap. Does not work either. The reason is that this file has been modified in the trunk. So, to apply the patch, i need to clone the repository at the revision r6025. Apply the patch, and test it. Now if I want to merge it back into the trunk, i need to build another diff between the head of svn and r6025, and cherry-pick the items to paste back in to the file. That’s manual, a bit tedious, and honestly… boring.

Let’s try the magical time machine from git. I clone the repository, and switch to the trunk branch ( that follow svn ). I revert to the commit 0bd41612aa2638bd5cd5c855beae03ca8bfd3ff4 which matches r6025. I have now the exact same code as in svn-r6025, and git makes merging a piece of cake. I try to apply your patch again. Same error. So it looks like your patch has been built on top of another modification.

I can’t apply it, nor test or merge it.

I need your help!

comment:6 Changed 2 years ago by tryagain

Hi!

I have added a new feature to navit with r6125. It's now able to parse environment variables in image paths.

So it is now be possible (i've tested it on linux) to use construction like this:

type=image label=$NAVIT_SHAREDIR/maps/3/0/0.png

Remember, variable $NAVIT_USER_DATADIR on Android in recent builds is set to the user selected map storage directory.

tryagain.

comment:7 Changed 2 years ago by tryagain

Since r6126 image items are displayed for me on Android.

For best results, map built with #854 patch is needed.

Still navit.xml should be patched to display raster map on proper zoom levels as described above by jandegr. Also, I feel we should patch navit.xml to disable road artifacts on low zoom levels, especially when rastermap is displayed.

I think we could even incorporate the map into the apk, so it's immediately available and does not confuse the user with an empty screen when he zoom out a lot.

We could introduce additional image item types to have two or more tilesets of different resolutions displayed at corresponding zoom levels.

Also. there are a couple of TODOs in the code. Are we going to implement them or just remove the comments for now?

tryagain.

Last edited 2 years ago by tryagain (previous) (diff)

comment:8 follow-up: Changed 2 years ago by sleske

Interesting, I did not know it was possible to show raster maps in Navit.

Still, I don't quite understand why this is useful. It seems like a significant amout of extra setup work (obtaining images, setting up the textfile map, configuring zoom levels) for something Navit could just render itself.

What is the advantage over rendering the country outlines in the normal way? If there is something missing, maybe Navit's rendering can be improved?

comment:9 Changed 2 years ago by sleske

  • Cc sebastian.leske@… added

comment:10 in reply to: ↑ 8 ; follow-up: Changed 2 years ago by tryagain

Replying to sleske:

Still, I don't quite understand why this is useful. It seems like a significant amout of extra setup work (obtaining images, setting up the textfile map, configuring zoom levels) for something Navit could just render itself.

Map and images can be shipped in navit installation package.

What is the advantage over rendering the country outlines in the normal way? If there is something missing, maybe Navit's rendering can be improved?

Planet coastline data is around 300MB, i expect similar size for country borders. We definitely do not want to process that amount of data in real time while rendering the planet overview.

Possible approach would be to simplify that data at maptool stage and use different preprocessed vector data at different zoom levels. That's what i was suggesting for #854, but jandegr came with almost a ready to use solution.

Also, this feature could be useful to make navit display some map data which is not (yet) available in osm (like topographic maps).

Last edited 2 years ago by tryagain (previous) (diff)

comment:11 in reply to: ↑ 10 Changed 2 years ago by sleske

Replying to https://wiki.navit-project.org/index.php/user:tryagain:

Ok, I'm convinced :-). For displaying coasts, I'd still prefer having simplified coast lines in the binfile (nicer for zooming, consistent look of the map etc.). But if you have some special map in image form, being able to show it can be useful. At least it won't hurt.

Note: See TracTickets for help on using tickets.