mapsforge and osmdroid

57 views
Skip to first unread message

Ahmed Madhun

unread,
Feb 14, 2018, 4:35:54 AM2/14/18
to osmdroid
Hey,

i am developing an android project that uses openstreetmap offline. I tried to download tails using OSMTilePackeger but it took long time.
I was searching for a better a way to implement it, and some where was suggested mapsforge.

can i just use mapsforge that is included in osmdroid 5.6.5 ? any tutorial to help ?
or just use the normal mapsforge library in github ?

Freudi

unread,
Feb 14, 2018, 5:43:53 AM2/14/18
to osmd...@googlegroups.com
There is a MapsForgeTileProvider. I use this code without any mapsforge lib's ... only:

dependencies {
compile 'com.android.support:support-v4:23.1.0'
compile 'org.osmdroid:osmdroid-android:5.6.5'
}

File mapFile = new File(removableStoragePath + "/germany.map");
File[] archives = { mapFile };
XmlRenderTheme theme = null;
try {
theme = new AssetsRenderTheme(getApplicationContext(), "renderthemes/","rendertheme-v4.xml");
}catch (Exception ex){ex.printStackTrace();}

MapTileProviderArray mProvider;
if ( mapFile.exists() )
   if ( mapFile.canRead() )
      mProvider =  new MapsForgeTileProvider(simpleReceiver, MapsForgeTileSource.createFromFiles(archives,theme, "rendertheme-v4"),null);


if ( mProvider != null )
{
mProvider.setUseDataConnection(false);
mapView.setTileProvider(mProvider);
mapView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}



--
You received this message because you are subscribed to the Google Groups "osmdroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmdroid+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/osmdroid.
To view this discussion on the web visit https://groups.google.com/d/msgid/osmdroid/2de91d33-959a-41cc-a55b-dede7c9d38d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ahmed Madhun

unread,
Feb 14, 2018, 9:52:47 AM2/14/18
to osmdroid
hei, thanks for answering .... quite strange that you didn't use  :

compile 'org.mapsforge:mapsforge-map-android:0.6.1'


but thanks, i will try and tell you how it goes
To unsubscribe from this group and stop receiving emails from it, send an email to osmdroid+u...@googlegroups.com.

Freudi

unread,
Feb 14, 2018, 10:12:27 AM2/14/18
to osmd...@googlegroups.com
I guess somebody of osmdroid did it. Sorry I can't remember every single step that I made,  I have a row that is commented out 
//compile 'org.osmdroid:osmdroid-mapsforge:5.6.4'
Maybe that was an older solution, at the moment I only have the both dependencies that I wrote. But when I looked at the "external section" I see that mapsforge is included.
Inline-Bild 1




To unsubscribe from this group and stop receiving emails from it, send an email to osmdroid+unsubscribe@googlegroups.com.

Alex O'Ree

unread,
Feb 17, 2018, 4:23:57 PM2/17/18
to osmdroid
hmm osmdroid has a mapsforge adapter that lets you use the mapsforge tile renderer in osmdroid. You can also just use mapsforge by itself.

To be clear, osmdroid-android does not depend on any mapsforge related stuff. Looking at that screen shot, android studio is probably just being strange, try restarting it

Freudi

unread,
Feb 17, 2018, 5:22:09 PM2/17/18
to osmd...@googlegroups.com
What is strange with that? Did the osmdroid mapsforge adapter implement all the mapsforge map reading and drawing stuff by itself? I can't believe that. My osmdroid app read and draws mapsforge maps, so it is clear for me that it needs the code from mapsforge.

To unsubscribe from this group and stop receiving emails from it, send an email to osmdroid+unsubscribe@googlegroups.com.

Alex O'Ree

unread,
Feb 17, 2018, 5:30:28 PM2/17/18
to osmdroid
The screen shot shows the dependencies for osmdroid-mapsforge is commented out, however the left hand said says otherwise.

Freudi

unread,
Feb 17, 2018, 6:01:26 PM2/17/18
to osmd...@googlegroups.com
Yes, I use osmdroid since version 3. More than year ago I started to test mapsforge with it. Since you have the mapsforge provider integrated in mapsforge I don't need the dependency anymore, because your mapsforge provider have it.

To unsubscribe from this group and stop receiving emails from it, send an email to osmdroid+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages