I know there are some Android maps libraries that can render vector based tiles from OSM (*.map, etc.). But I did not found any library that only has engine to graphically render vector tiles and returns it as TileProvider to the Google maps api v2 for Android.
For the offline raster tiles: I know how to do for the raster tiles
(osmdroid jpg files). Good and working example:
TileProvider using local tiles.
Does anybody know where to find this for vector tiles?
Kind regards,
Toni
If you can find a library to render the vector tiles, or enough documentation of the format to write your own renderer, it's pretty easy to turn it into a TileProvider. Tile#data needs to be a compressed image in one of the supported image formats. Once you have a Bitmap, use Bitmap#compress(...) to write the data to a ByteArrayOutputStream, then use ByteArrayOutputStream#toByteArray() to get the data for the Tile.
Related
I'm new at osmdroid and I'm trying to build simple GPS tracking application that must work offline. So first of all I know that osmdroid works with .osm But how to download osm file directly to my android device and more importantly how later I need to use it. I dont understand .osm file is simply just xml with lots of coordinates and other data. So how that .osm file can be transform to a graphical map? I know that is necessary to parse .osm file to get data, but where to download actual graphical map?
osmdroid does not currently present .osm data, mainly due to performance reasons. osmdroid does render raster images that someone can capture into a zip or database and then transfer to device. The problem really is space. It's a big planet and getting raster images can be huge! You'd have to prepare geographic regions into a database then host them somewhere and have your app download them on demand.
osmdroid as a wiki on offline maps here:
https://github.com/osmdroid/osmdroid/wiki/Offline-Map-Tiles
An alternative approach is something like Mapsforge, which can preconvert .osm data into their own binary format, also chunked up by geographic region. Same rules apply, however the file/download sizes are much smaller. Support for osmdroid using Mapsforge is in beta at the moment, however mapsforge can run on it's own and has it's own demo apps and whatnot.
To transform the .osm file into a graphical map, you need something like renderd and a slew of other tools, all on open street maps wiki. Again, you need a boat ton of storage for the planet to convert it into raster images. Then you'd still have to package them somehow and get them on device.
Or you can just use online maps.
In my android project I want to have offline maps. with tiles my map takes 500 mb of space and I also want to search address on the map offline.
I think the only way to decrease size and make it possible to search , vector maps. How can I use vector maps in OSMdroid ? Where can I get vector maps ?
AFAIK most would use Mapsforge in your case: http://wiki.openstreetmap.org/wiki/Frameworks#Widgets
For reducing the size of tiles you can zip your tiles and copy it to osmdroid folder in sdcard (You must keep current structures of tiles folder).
But you can use KML files in osmdroid as a data source for handling features with
OSMBonusPack to load kml file in osmdroid map.
Also see this example.
I´m actually doing a CustomTileProvider for Android, but I dont have idea how can I create tiles from MapTiler. It ask´s me for a Raster map Files, but Is there any tool to generate this map files.
MapTiler (http://www.maptiler.com/) can process normal images - such as a scanned paper map saved as JPEG or TIFF. You can also create a map in Adobe Photoshop or similar software. See: Visually aligning a jpeg image to Google Maps in preparation for Photoshop tile cutter
MapTiler opens the standard GIS data formats too (GeoTIFF, ECW, MrSID, ...).
Free geodata (opendata) are avaialable on the web nowadays. For example:
topographic maps for hiking (USGS DRGs) at http://www.archive.org/details/maps_usgs
nautical charts for sailing (NOAA) at http://www.nauticalcharts.noaa.gov/mcd/Raster/
etc.
Some typical maps rendered with MapTiler are visible at http://tileserver.maptiler.com/:
The free geodata are available in USA and some countries in Europe from the government websites.
High-quality geodata can be also purchased from various commercial data providers.
UPDATE: MapTiler Desktop application and command-line MapTiler Engine can now also generate raster tiles from vector data input (typically in PDF or GeoPDF format).
MapTiler tools can produce also Vector Tiles (MVT) from ShapeFiles or other vector GIS data - which can be displayed with Android/iOS native GL accelerated components or with client-side styles in a web browser. Maps made with vector tiles can be freely zoomed and rotated - with placenames displayed always in a readable non-rotated form. Look at https://www.maptiler.com/maps/ to see such maps - and create an account to make similar maps like this on your own. ;-)
I am starting to use Osmdroid and I would like to use this technology for showing a map about an F1 circuit. I have a big picture and I can cut it up to divide it into smaller tiles.
Can I modify the osmdroid library for the upload of these pictures?
I would like to save these bitmaps (tiles) in my assets folder.
I am pretty lost on how to do this.
I am using this way because android, normally, gives a memory error when I try show this complete full-size picture. If I only show some tiles of the image (depends of the zoom) maybe my app would work better?
Thanks in advance!
Osmdroid uses a system in which world map is divided into tiles. Tiles usually have the same pixel size which means that the bigger zoom level you use the more tiles are needed to "cover the world". Each tile has its coordinates (x,y) and a zoom level in which it is designed to be used.
It is possible to use various custom tile sources in osmdroid. Take a look at this class in osmdroid - it creates instances of some tile sources. You can create your own tile sources using the same mechanism. However, all this uses these x,y coordinates of the world I described above. Osmdroid will ask your tile source for example for tile 10,10 in zoom level 10. If you are able to create tiles of your map to work with this coordinates system then it will work. However, it may be hard to do this for custom maps such as F1 circuits.
I am also interested in this and probably will try to use tiling mechanism of osmdroid to display some big images in the near future. If you succeed in this please let me know:).
I think there's two questions here:
How to create osmdroid format map tiles from a bitmap file.
How to load them into osmdroid
For question 1 you can use a tool to create your tiles.
http://www.maptiler.org/
Can be used to create tiles from a bitmap giving in your bitmap and its boundaries coordinates.
http://mobac.sourceforge.net/
Creates Atlas from online maps, it can create osmdroid zip atlas. Not sure if you could use it to create your osmdroid zip format.
If Mobile Atlas creator doesn't help perhaps you can create the zip manually if your source bitmap is not too big.
For question 2:
I extended an osmdroid class to deploy maps in an apk using the asset folder. See here:
https://stackoverflow.com/a/14832770/891479
I want to generate a new mapsource from a GeoTIFF file to display it in osmdroid.
I Dont find any solution to convert the GeoTIFF file into the MapSource format osmdroid needs.
You can use Maptiler to generate tiles from your GeoTiff. Then you need to either host these tiles for download somewhere or provide them with your app. Osmdroid allows you to provide the tiles in a zip file, although this did not work for me for very large archives.
You'll then have to add a new tile provider in osmdroid to consume your tiles.
Here's an example of how to provide you own tile source to osmdroid.