I have a KMZ vector file which works fine on my Google Earth application, but i want to overlay this on my phone (android) through Google maps.
Is that possible?
A KMZ file is simply an archived structure, containing a main KML file and zero or more supporting files. I'm assuming you want the KML data? That's what represents the "route"-like content of the KMZ.
As far as displaying a KML file goes, it's been done before - check out this previous SO question - it involves parsing the KML with a SAX parser (or other compatible parsing class) and piecing it into a path. Once you have a list of coordinates, you can create a custom Overlay class, which could take in a coordinate list as an argument. Then, on the onDraw() method of the Overlay class you simply draw a path representing the list of coordinates. For more information on drawing routes, check this out.
If that's not what you're looking for, drop a comment and I'll see what I can do!
Related
I have a question about SDK Google maps in Android
I have a Autocomplete Place that works perfectly. When i write some text in the input, google show me locations, and when i click on any print coordinates.
Question:
Is there any way to know if those coordinates are in a polygon of a Google my maps kml file?
I tried:
KmlLayer(map,id for local file, context)
Documentation: https://developers.google.com/maps/documentation/android-sdk/utility/kml
The problem is that i need the local kml file on my local repository. I need to get KML file from URL with a map id (https://www.google.com/maps/d/u/0/viewer?mid=XXXXrsxRFHqpMEmYXXXXX)
That "mid", can change, since sometimes I will need to use another kml file with a different url.
Also, Autocomplete documentation: https://developers.google.com/maps/documentation/places/android-sdk/autocomplete
Thank you everyone.
Any help would be greatly appreciated! Thanks
I downloaded a payed .mbtiles file from Open Street Map and managed to create nice maps using openmaptiles-server over Kitematic.
However, I would like to use this .mbtiles file as offline repository of tiles in an Android based application I'm writing.
My plans are to have the mbtiles file stored on an SD card, and let osmdroid MapView read it from there.
However, the file doesn't contain (apparently..) the styling information on its own.
My question is how do I add a styling info such as "OSM Bright" or "Klokantech Basic" to my project so the map on my application looks like a proper map
Many thanks
It's not possible to render bitmap tiles on a device just from information contained in mbtiles data file.
What actually is a mbtiles file?
A mbtiles file is just an SQLite database which contains a very little amount of metadata and rendered bitmap images - tiles Those are the same bitmap files you would be serving online from your openmaptiles-server.
Size of mbtiles file versus size of tiles
MBtiles file size should be almost the same as the overall size of all generated files on your mbtiles server (it's the same number of tiles in each zoom level and the same number of pixels in each tile). If you see a significant difference, it may mean that your mbtiles file doesn't contain the same zoom range (e.g. it doesn't actually contain those most detailed zoom levels) or it contains a smaller area. Some difference may be also caused by a compression algorithm of contained bitmaps and here the actual styling of tiles may play some role (some bitmaps may be easier to compress a resulting PNG may be smaller.
It may be also possible, that the mbtiles file actually contains another image format (jpeg).
If you want to explore what is actually contained in the downloaded mbtiles file, try this tool.
Solution
I don't' think there is a solution when you need to use bitmap tiles. You need to either generate them on a server and download them via network, or you need to prerender them and pack into a mbtile file and download that to a device somehow.
One possible solution would be to use vector maps. It's actually possible to generate vector tiles from Openstreetmap data. Such tiles are than rendered on a device and can actually be styled on the device too.
Unfortunately, Osmdroid library does not support vector tiles at the time of writing (AFAIK). You would have to choose a different map rendering library.
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.
I have a KML file which is created from maps.google.com. And i want to draw a route on google map.
I am using mapV_2 in my project. Also one more thing I read couple of threds here on SO saying that KML is no more working on google map One, Two. So is it really not working today for Android? Any othe way to get this done?
I would like to display rich maps contained in Autocad .dwg files in my Android app. I'd like to know if there is an existing java library to do so?
If not, is it doable to translate a dwg file to a model and draw that model shape by shape on the screen?
I can't use Google maps instead of these files. The whole point of the app is to display a map with a lot of data and all that data is contained in my autocad files library.
Besides, is there an alternative format to DWG that I could use to do exactly this? (UPDATE: would SVG do the trick?)
What I ended up doing is to convert all my files in KML. I've selected this format because it might be the most used format on Android to do GIS.
To make a custom map, I'm drawing overlays on a mapview using these hints. It's basically the most interesting solution. I don't need to pay attention to geolocation stuff, the cursor and the scale are manage by Google API itself.
If you're going to convert I'd probably suggest DXF. I haven't used it, but YCad is a java DXF library. There are also a number of DXF to SVG converters available but it's probably best to avoid two conversions.