I am currently doing the android apps to determine the road surface condition. When i have all handphone sensor data in text file format, i need to convert to kml. to get the allignment, i convert the file to xls. Then i have 3 way to convert it.
By android apps to convert the kml.
By manually,
-retrieve coordinate from the file and save it to xls.
-use excel equation to decide the line color by using accelerometer and orientation data
-put to www.earthpoint.us/ExcelToKml.aspx to convert xls to kml
-put the kml to google earth to do analyzing
By automated. could be VB, JAVA and etc. but i m not familiar which program can do it
nicely.
Thanks
I am not completely sure what you are wanting to do here, but if you build this all in android then you can simply use Java Regular Expressions (java.util.regex) to parse out the sensor data into kml. You would need to open the sensor file, parse, and then output into the kml file.
I think you have all the steps to do this manually.
If you are building the app as described in #1, then you don't need this. All those program languages you described, can do what you want.
Related
I have a .ckpt checkpoint file used for image recognition from my data scientist and I would like to convert it to .pt file using instruction from the pytorch instruction website:https://pytorch.org/tutorials/beginner/deeplabv3_on_android.html
This is what I did:
**model = torch.load(os.path.join(model_path,'Image_segmentation.ckpt'), map_location=device)
model.eval())
scriptedm = torch.jit.script(model)
torch.jit.save(scriptedm, "Image_segmentation_Android.pt")**
However I got the following error while trying to do so:
NotSupportedError Traceback (most recent call last)
<ipython-input-31-a8138feb2578> in <module>
1 model = torch.load(os.path.join(model_path,'model_eyeglasses.ckpt'), map_location=device)
2 model.eval()
----> 3 scriptedm = torch.jit.script(model)
4 torch.jit.save(scriptedm, "model_eyeglasses_Android.pt")
5 model.to(device)
After some reading, it seem that both file type can be used in Android development. I usually script in python and is very new to Android so I cannot be sure.
I was wondering if someone can confirm this? Unfortunately, I wont be able to get in contact with our data scientist for quite sometime to train another model in .pt format.
Many thanks for you help
There isn't an established difference between the file suffixes, because you can save arbitrary Python objects using torch.save, using any suffix you want. For example: you can directly save the model itself, or you can save a dictionary that includes multiple models. (Related answer: https://stackoverflow.com/a/70541507/13095028).
As for why JIT scripting failed however, there can be a variety of reasons. It could be that the tensor operations involved in the model genuinely is not supported (ref: https://pytorch.org/docs/stable/jit_unsupported.html).
It could also be a file loading error depending on how the model is saved. You can either save the model object directly, or just save the state_dict. They need to be loaded differently as per Pytorch docs: https://pytorch.org/tutorials/beginner/saving_loading_models.html#saving-loading-model-for-inference
I have a problem with the Android emulator. I am creating an app which uses location in order to register tracks etc. The problem is: when I load a GPX file in Extended controls of the emulator, locations are not sorted correctly thus the man on the bike jumps from his usual route to the completely different part of the route.
The red line is the registered track. It has one big fluctuation and then returns to the normal route. In the "Extended controls" window you can see that in the "Name" column there is a number 62 even though the others are numbers from 55 to 49 listed in order. There are plenty of those "number jumps" in the entire column.
My question is: can I somehow set an order by name in extended controls? Even then, how about other GPX files which don't have included "name" parameter? Maybe I should change something in the GPX file? Or load it differently?
Here's one workflow to workaround the ordering issue - this approach adds the ordered timestamp as mentioned in other answer by #Miq.
Generate path using google maps and export URL (or upload existing gpx file).
Use GPS Visualizer ( http://www.gpsvisualizer.com/convert_input ) to convert to GPX (paste URL into the field 'Or provide the URL of a file on the Web:' and use the advanced option 'Add artificial timestamps (for OpenStreetMap import):'
Press the convert button and paste the output into an editor for saving locally.
Load file using Extended Controls - Location.
The ordered timestamps does the trick to maintain path order. The actual timestamp values are not important, just the relative order.
There's no way of sorting given locations in emulator.
If your GPX file provides <time> element, loaded points are sorted according to that value plus delays are added.
However this parameter is optional, so in that case emulator should load it in file order, but it doesn't (as you noticed). It seems that it is a bug in Android emulator - points from KML files are loaded in order.
As for now, convert your GPX to KML format or check if your device can provide time entries.
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.
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.
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/