pbf files in android application - android

I'm developing an offline routing application for android.
I'm working with osmdroid library. and I downloaded the pbf file for the region where I want to do the offline navigation but I'm not sure how to be able to convert the binary representation of the maps in the pbf files into a normal text.

You don't have to use the PBF format, at the moment the OSM XML format is still widely in use. But if you do, then you will probably have to implement a PBF reader for Android. See osmosis which serves as the reference implementation for PBF and can also convert between those two file formats.
You can take a look at the Android page in the OSM wiki where lots of OSM-related Android application are listed. Maybe there is already an Android application supporting PBF. But most of them will just display tiles and the rather popular OsmAnd uses its own file format instead.
Note that PBF has various advantages compared to XML. It is smaller and it is faster to read and write than compressed XML. It also supports random access which can become very handy for a routing engine.

Related

Unity3D Android - Download assets from an API and import on device?

Questions are first then some description which helps explain the questions:
Questions:
Will Unity be able to easily import downloaded assets from our API if we save them in a specified directory with our core Android app?
Can we pre-serialize the 3d model assets before uploading them to our API so that they do not need to be serialized by Unity on device? This is so that they load faster
Description
I'm not a Unity/3D developer or an Android developer so apologies if this question doesn't meet community guidelines (I built the API in this scenario). This is also probably very long for what should be simple questions.
We've built an API which serves 3D model files in Collada 1.4 (.dae) format to iOS and Android client applications. File sizes can be quite large (upwards of 80-90mb in some instances) although the majority are in the 4-15mb region.
On iOS we've been having the application download the models from the API and then render them onto the screen via SceneKit which has been relatively simple to achieve. We put the Collada files through a preprocessing step before serving them which converts them into a proprietary format used by SceneKit.
In Android we've encountered any number of problems. We initially experimented with converting models to OBJ instead of Collada and using Rajawali, jPCT and a few other loaders for Open GL ES2.0 but due to our file sizes the time to read and load the models was far too long. We've now decided Unity is probably where we need to go on Android as a rendering engine.
The Android app will consist of two parts, a core app which has an interface for viewing images of the models and downloading the model files and a Unity app which is loaded via an activity from the core Android app to actually render the models.

Read a dng file as a 2d array of pixels in android

I have a DNG file that my camera2 application generates. I want to read that file as a part of another android application and process the values at a pixel level. I haven't found a way to read the same. Are there any approaches I can use?
There's no built-in API in Android to read in full-resolution DNG files (As of Android N, you can read in DNG thumbnails via some new APIs).
Your primary options are to use Adobe's DNG SDK, or use one of the open-source libraries such as libraw. I don't know if any of these have a Java interface.

Read & write shapefiles in android or java (.shp)

Read & Write shapefiles in android or java
How can i read and write shapefiles in Android or java?
.shp .shx and etc
i much searched but nothing
I want read file and edit information and write in same file or new file.
This is important i can write to file. i can read file but this isn't my problem
Thanks
Take Gdal for Android for a try.
Gdal
A translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source license by the Open Source Geospatial Foundation. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing. The NEWS page describes the January 2017 GDAL/OGR 2.1.3 release.
Read/Write API Tutorial
Building for Android on Linux
Either, Google for pre-compiled package

Importing Offline Map Nutiteq From Open Street Map

I am currently trying to import an offline map to nutiteq.
I have downloaded a map from OpenStreetMap but that map has an .osm extension.
How can I import that kind of extension to Android ?
As scai mentions, .osm is raw data file which cannot be directly used. .osm is data exchange format and it needs processing to be used in applications, including apps with Nutiteq SDK. Main missing piece from .osm file is visual styling: .osm file defines coordinates of objects and identity (e.g. that a line is "highway"), but it gives no hint whatsoever how to draw it - with which colors, line width etc.
What I'd suggest to try is to convert .osm file to .map file using osmosis, and then use mapsforge library to render a map like shown in Nutiteq wiki page. Mapsforge includes some default style, but you can find nicer stylesheets. There are several providers for readymade and up-to-date .map files with OpenStreetMap data, so maybe you do not need to do the conversion, one of them is AndroidMaps who even includes even several stylesheets.
.osm is just OSM's XML file format containing elements and tags. That is, it contains raw data. According to the nutiteq website nutiteq doesn't support this format directly. But it supports various other formats like MBTiles which are suitable for offline use.

2D tile game map storage

I'm new to game programming, and am trying to write the Map storage portion of my 2D tile based game on android. At first, my plan was to store the maps in XML. I found a tool (http://www.mapeditor.org/) that stores the created maps in a format close to what I was thinking. However, it seems like Android is very limited when it comes to XML. I'm used to working with XML Beans which doesn't work on Android, though I admit XML Beans would probably be too resource heavy for mobile devices anyways. However, after searching around for XML parser options, it seems like even basic XML validation isn't even included by default with the Android SDK. It's starting to look like XML might not be the best answer.
Does anyone know of a good standard way to store map configuration besides XML? Or some strong XML tools available in Android that handle validation (against a defined schema), and preferably simple parsing? I would really like to avoid defining my own flat file text format for maps...
Check out AndEngine. If I remember correctly AndEngine already has the classes needed to load a map from an XML file for rendering.
As far as a standard way to store map configurations, I would say XML is the way to go. I mean you could create your own format, but why re-invent the wheel?
I parse XML in Android with javax.xml.parsers.DocumentBuilderFactory and various other XML parts. It hasn't failed me yet!
For example see: http://www.developerfusion.com/code/2064/a-simple-way-to-read-an-xml-file-in-java/

Categories

Resources