How to prepare KML file for Android Emulator Control? - android

I am trying to test my application with location information.
You know the Emulator Control has an ability to load from KML file. (Eclipse -> DDMS -> Emulator Control -> Location Controls -> KML -> Load KML...)
I've prepared KML file using Google earth application with its "Add path". Then saved it by .kml extension and load it on the Eclipse. Eclipse didn't load this KML file.
How to prepare KML file for Android Emulator Control?

I've found solution :
KML format is :
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.x">
<Placemark>
<name>1</name>
<Point><coordinates>-109.0450005395891,33.39487928579279,0</coordinates></Point>
</Placemark>
</kml>

The KML format that's accepted by ADT (0.8.x) differs from the Google Earth (or even Google Tracks) format.
Convert the original KML file at http://ge2adt.appspot.com/, use your Google account to login.
You can now try to open the file in the emulator control. I still couldn't open the KML file in the emulator. Open the KML file and remove the 'Document' element, don't delete the 'Placemark' elements. Also check if there multiple KML definitions ('kml' element). I had two definitions with only one placemark, and one correct definition with multiple placemarks. Delete the definitions with only one placemark.

Just tested this, and found actually the only thing you need to change to get the ADT to accept your KML file is to change the namespace to http://earth.google.com/kml/2.x.
You'd think someone at Google would have sorted this out by now...

The KML file must be a 3D file - some GIS tools (e.g. QGIS) don't put the Z value in the output if it is not present in your input data. A simple search and replace to add ,0 before each closing </coordinate> tag will solve this problem.

Related

How to create Maps.Me .mwm file extension?

I want to know what is .mwm file extension, how can create this file type for using in Maps.Me android application?
I want to use Maps. Me API and create map application that will work offline, I saw in storage that application download maps to directory as .mwm file, and this file little, compact file that whole map comes from this file. I want create this file type but dont know the structure of this file. How can I reach this? Thank you for patience. All suggests are acceptable
.mwm file is nothing but the downloaded map file of an particular area from the maps.me also you can get the map using this link http://direct.mapswithme.com/direct/latest/

tile file names different between tiles generated with Mobac and loaded from Internet?

I want to use offline tiles in an Android app using OSMDROID to avoid downloading via Internet. According to several examples here I started to use Mobac for creating tiles of a certain area in OSM MapQuest format. I also folllowed the instruction to generate jpg-format instead of png. The zip-file was generated too succesfully, but the tiles are not displayed in my app. I also checked the folder structure and I also modified the path "MapQuest" to "MapquestOSM", but all experiments were not successful.
The tilesource in my code is set to MAPQUESTOSM and all works fine, when I load the tiles from the Internet, but when I try to read it from my phone-directoy, nothing is displayed.
What I have seen is that on my phone the downloaded tiles have the file name ".jpg.tile", but Mobac generates ".jpg. I extracted the zip file and when I change the file name also to .jpg.tile, then the changed tiles becomes displayed (only the changed ones!). I have not found any issue related to this file name difference!
In my code I use from examples the setTileSource (works for Internet loading):
mv = (MapView) findViewById(R.id.mapView);
mv.setUseDataConnection(false);
mv.setTileSource(TileSourceFactory.MAPQUESTOSM);
on my Samsung J5 the tiles are loaded from Internet into directory /osmdroid/tiles///.jpg.tile
Has there been a change in the file names or what could be wrong. Nobody seemed to have this problem in the past?
The behavior with downloaded tiles vs tile archives produced by mobac or some other tool is expected (extra file extension in the /sdcard/osmdroid/tiles folder).
If you putting a mobac produced archive to a device for osmdroid, put it in /sdcard/osmdroid/
within the archive (assuming zip here) the path in the zip should be
{source}/z/x/y.extension.
The "source" part is what you osmdroid that the source is. It must match exactly or else the tiles will not be loaded.
See the wiki for more info
https://github.com/osmdroid/osmdroid/wiki/Offline-Map-Tiles

Does a file operation (move, rename) change last modified field of a file?

What does "lastmodified" describe? Just the file's content or also file system related things like file name and Path?
My interest goes especially for the Android platform. I will store data in my app's directory. A quick test showed, that a Samsung Android device with Android 4.2.2 does not change the date when moving files with the build in file browser.
from my experience it doesnt change it. After such operations I manually do
file.setLastModified(System.currentTimeMillis());

Android application folder in google drive

I have an android app that reads spreadsheets from google drive and shows it to the user as a contact list. It is design to be a phone list you can send to your team members.
https://play.google.com/store/apps/details?id=com.ctw.cloudpeepsfree
Anyway, to get to work, all of the Google drive file names need to begin with prefix "peep:". I have heard rumors that with the latest versions of Google Drive API, I should be able to instead put all of my app files into a special folder that only my application can read. I was looking for some sample code or article on this subject. Thanks...
found this blog:
http://googleappsdeveloper.blogspot.com/2013/04/more-ways-for-apps-to-write-to-drive.html
You can use application data folder in your case, but use won't be able to list the file you put it on appdata folder: https://developers.google.com/drive/appdata
In order to put a file in the appdata folder, just set its parent to "appdata":
File body = new File();
body.setTitle(title);
body.setDescription(description);
body.setMimeType(mimeType);
body.setParents(Arrays.asList(new ParentReference().setId("appdata"));
service.files().insert(body).execute();

Listing files with same extension using google drive sdk

I have been trying to integrate google drive sdk in my android application. It all seems to work fine but now i have a requirement where in i would like to list out all the files with the same extension. For example I would like to get a list of all JPG files that the user might have saved to his google drive.
For doing this i tried to use the following
FileList temp = service.files().list().setQ("title contains 'jpg'").execute();
But this does not return me anything.
On the other hand if i replace jpg with one of the words in the file name then it seems to work fine. So strangely a search on extension is not working while a search on the main name seems to work
Is this functionality broken with the drive sdk or am i missing something here?
Google Drive determines file types based on their mimeType attribute, not their extension. Instead of looking at the file name, try something like:
FileList temp = service.files().list().setQ("mimeType = 'image/jpeg'").execute();
From the comment left by Burcu Dogan it is clear that at this point of time querying based on file extensions is not possible. Will have to wait for an update to the google drive sdk to include such functionality.
Putting this out as a note to help anyone who might be facing a simialr issue and looking for a solution.

Categories

Resources