Android Tutorial OSMDroid - MapView for B4A tutorial

DonManfred

Expert
Licensed User
Longtime User
but i want to try offline map.where i can download offline map for OSM Mapnik?
Use MOBile Atlas Creator (like described in Post #1)

Start the tool, select a working tilesource, slect a small area and define which zoomlevel you want to have, add the selected area to the Atlascontent... Create Atlas

 

supriono

Member
Licensed User
Longtime User
Use MOBile Atlas Creator (like described in Post #1)

Start the tool, select a working tilesource, slect a small area and define which zoomlevel you want to have, add the selected area to the Atlascontent... Create Atlas

thanks ..
but i don't see map...image only cros X
 

androidvh

Member
Licensed User
Longtime User
Dear Martin,

I use your libary in version 4.1.
Since yesterday no tiles are loaded.
You can check it if you rename the osm folder.

Any idea?

Kind regards Volker
 

cas6678

Active Member
Licensed User
Longtime User
Hello

¿Is there any tutorial to work with offline maps?

I want to know how to generate a map file to work offlline, where to locate and how to make this library you use this new map.

Thank you.
 

warwound

Expert
Licensed User
Longtime User
Hello

¿Is there any tutorial to work with offline maps?

I want to know how to generate a map file to work offlline, where to locate and how to make this library you use this new map.
Are you talking about creating a mapsforge .map file?

If so then look here for general documentation:
https://github.com/mapsforge/mapsforge/tree/master/docs

And here in particular for documentation about the .map file creation:
https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md

I can't find a forum link to the tutorial on using a .map file in OSMDroid but i'm sure if you search for 'mapsforge' you'll find it.
 

cas6678

Active Member
Licensed User
Longtime User
Hello @warwound

I don`t know mapsforge. Now I´m read your links.

Maybe I´ve problems with the translation from Spanish, sorry.

I tried your library and works very well, thank you.

But I want to use offline, the questions are:

It's possible?

That software to create the map?

Where I place the map to your library can use it?

Maybe some example b4a for maps offline whit you library?

Thanks.
 

Medexpert

Member
Licensed User
Longtime User
Dear All,

I didn't found solution for street font size on high dpi display. I use Samsung s6 and street name on map is too small in the bigest zoom view too.
The library is OSMDroid 3.08.
Could you help me what is the solution?

Thanks in andvanced,
Istvan
 
Last edited:

maso1975

Member
Licensed User
Longtime User
Hello everyone, after searching a lot in this forum and on the internet, what I have left is to ask. In advance I thank anyone who takes five minutes to answer and my question is the following:

Why, according to the terminal model where I install an application with a mapview and omsdroid, the map is visualized with different scales?

For example, if I use a Galaxy Core 2, the map has a maximum zoom scale of 113m and if it is a Galaxy S3 the scale is 160m or 120m I do not remember well.

On the other hand and I approve to ask, as I could do an additional zoom to the map, ie, I need to be able to zoom up to at least 10m according to the scale, it is possible, since I have seen applications with the same titles that I am Using which I downloaded with Mobile Atlas.

Somebody could help me.

Thanks again.
 

maso1975

Member
Licensed User
Longtime User
Hello Medexpert, from what I am seeing, your problem is similar to mine, that is, from what I understand, the scale of the map in the S6 is very small, the same is true with my S6, when I execute the entire map application It looks very small, if I do in a Core 2 for example, it looks a little bigger, all this in the maximum zoom and I can not find the solution.

Greetings.
 

maso1975

Member
Licensed User
Longtime User
Hello, I think the problem of map scale is a limitation of the library, after searching and searching without stopping, I found here: https://github.com/osmdroid/osmdroid/issues/81, a solution that raises Kurtzmarc:

To fix # 49, we would also like to add something like this to MapView:

Public void setTileSource (final ITileSource aTileSource) {
MTileProvider.setTileSource (aTileSource);
Float density = getResources (). GetDisplayMetrics (). Density;
TileSystem.setTileSize ((int) (aTileSource.getTileSizePixels () * density));
This.checkZoomButtons ();This.setZoomLevel (mZoomLevel);// revalidate zoom level
PostInvalidate ();​
}

And here: http://stackoverflow.com/questions/7240568/osmdroid-display-tiles-bigger, another that poses this solution:


final float scale = getBaseContext().getResources().getDisplayMetrics().density;
final int newScale =(int)(256* scale);
String[]OSMSource=newString[2];
OSMSource[0]="http://a.tile.openstreetmap.org/";
OSMSource[1]="http://b.tile.openstreetmap.org/";
XYTileSourceMapSource=newXYTileSource("OSM",null,1,18,newScale,".png",OSMSource);
map.setTileSource(MapSource);​

Of course this is in JAVA.

Anyone know if you could bring this code to B4A, or use the JAVA embedded in the B4A code to use any of these solutions?
 

tracklocator

Member
Licensed User
Very good work @warwound has helped me a lot to get tiles from two sources or more is documented in one of the threads and I do with version 4.1 and works well

B4X:
MyTileSource.Initialize2(MapView1, MyTileSourceName, Array As String ("URLservertiles.png", "URLserver.tiles1.png"), 0, 18, 256)
            TileSourceFactory1.AddTileSource(MyTileSource)
 

cas6678

Active Member
Licensed User
Longtime User
Hi all.

After a lot of testing I have the working example with the OSDDroid 3.08 and OSMDroid 3.08 MapsForgeTilesSource libraries.

Now I want to add the rotation of the map and I have read that I need to use the library 4.1

But I do not find the new methods and properties equivalent to 3.08 for 4.1. I need These:

MapView OSMDroid_MapView
Methods:
AddOverlay
(anOverlay AsOverlay)
AddTileSource (TileSource1 AsITileSource)
FitMapToBoundingBox (BoundingBox AsBoundingBoxE6)
GetCenter AsGeoPointWrapper GetMapCenter AsGeoPoint ???
GetTileSources AsList
SetCenter3
(aGeoPoint AsGeoPoint)
SetMultiTouchEnabled (Enabled AsBoolean)
SetTileSource (TileSource AsString)
SetZoomEnabled (Enabled AsBoolean)
Properties:
Zoom AsInt
MyLocationOverlay
OSMDroid_MyLocationOverlay
Properties:
CompassEnabled AsBoolean Enabled AsBoolean ???
FollowLocationEnabled AsBoolean Enabled AsBoolean ???
MyLocationEnabled AsBoolean Enabled AsBoolean ???

Thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…