I'm using PhoneGap (3.0) to build an Android/iOS application.
The application revolves around maps and I came to the conclusion that loading tiles from a distant service like OpenStreetMap for example is way too slow and depends too much on 3G.
Is there a way to store tiles inside my application?
If yes, where can I find some documentation, code snippets, etc?
This depends on whether you are planning to use your own custom maps or want to use a 3rd party mapping service and therefore want to cache their tiles offline.
In the first case, I have some experience of this; I've produced a series of guided walk apps which use large custom maps I drew in Adobe Illustrator. See my stackoverflow question and subsequent answer for details, but in summary I used a tool called pngnq to create highly compressed 256 colour 8-bit PNG tiles of my maps which were small enough that I could bundle several zoom levels of tiles along with each app. I ended up implementing a custom mapping solution to enable fast enough performance of map scrolling and zooming when using my Phonegap app on older Android devices.
In the latter case, if you plan to store 3rd party tiles offline, you should first check that you aren't violating the terms of use - some mapping providers specifically prohibit offline caching of their map data.
Assuming this is OK, you may want to consider using leafletjs to power your maps. You may want to check out this blog article on HTML5 Offline mapping and this Phonegap-specific one. Both have links to proof-of-concept apps on GitHub where the source code is available.
Hope this helps!
Related
I'm working on indoor navigation application, I need to build map with 3D overlays, in addition I need to move, zoom and rotate the map using the touches.
so when I searched about that I found google maps API and some strong libraries such as LibGDX, I worked on LibGDX with TiledMap, but I faced some problems in touches and animation, so I think the google maps API is more powerful.
can I use google maps API for indoor maps only, like this image:
if yes, please tell me because I'm not starting to learn it yet, else, what the best library can I use to do that and if there is good tutorials?
I will be grateful for help.
Alright, in my opinion you have tow major choices:
You do it appropriatly with a real mapping software. Then I would suggest you to use cityGML or indoorGML, especially when you have navigation in mind. There are tools like Esris city engine, deegree 3D or 3D city DB which might be of help. Then there are things like the ArcGIS API for building your application - but beware, the implementation on mobile devices is very buggy in my experience. There are also free Java city/indoorGML libraries that you can use, not sure on their support for Android though.
Meanwhile Google Maps API is supposed to support 3d as well, but I doubt it works for real 3d as I've not seen custom buildings yet. There might be a compromise using Google Earth API and overlay it with a KML indoor model. The possibillities are of course restricted with KML, on the other side, city and indoor GML is fairly heavy workload while sketchup and KML is lightweight.
The maybe better way would be quick and dirty: Make a browser application using WebGL. Then you can use JS libraries like ThreeJS which is fairly easy. This has the advantage to be platform independent, very customizable and well looking, the Android Chrome browser supports WebGL as well. For navigation you would have to build your own logic.
I have been working on hybrid application development and web application using cordova, jquery and backbonejs.
I have the following features to be implemented.
1. adding markers
2. Overlaying list window
3. Overlaying pie-chart
4. Define/add/remove/change geo-fence using polygons
I have two options to implement the google maps v3 in the application.
Using jquery-map-ui v3
Directly loading the map from the google server
Which option is the best one to implement ?
Since your question is only tagged for android I would suggest you to use https://github.com/wf9a5m75/phonegap-googlemaps-plugin. It provides a javascript wrapper to leverage the native Google Maps on iOS and Android. It supports a lot of features out of the box, like markers, polygon drawing, several types of overlays, etc If you are not targeting other platforms than Android or iOS I would certainly use this one as, being native, it is very responsive.
If your map needs complex customization(customized popup, customized icons, customized lines etc), my suggestion is the section 2 because you could get many 3rd party plugins to work with your app.
However, there is no doubt that if you only need a simple map, jquery-map-ui is a better option.
Is it possible to programatically from an Android app to export maptiles from osm?
Or to force a specific area to be cached?
I am trying to create an app that can cache/download an area of the map programmatically so it can be available offline when needed.
It doesn't have to be osm but from what i've read doing it for google maps would violate theirs terms of service.
If someone could point me in the right direction i would appreciate it.
Thank you for you time.
Mobile Atlas Creator works perfectly, but having similar feature directly integrated in Android app would much simpler for end-users.
There is a thread about this subject in the osmdroid Discussion Group, here:
https://groups.google.com/forum/#!topic/osmdroid/u0SXXzqHg4U
If you want this feature, don't hesitate to "vote" for it in the Discussion Group thread (10 votes requested :-).
You are probably looking for something like Mobile Atlas Creator. But note that even "free" servers don't necessarily allow you to bulk-download tiles. See osm's Tile Usage Policy for example. Alternately, you can download the raw osm data and run your own Tile Server.
I use Titanium, which has a map view built upon the native specific maps for iOS and Android.
What would be the difference between using a native map and opening a webView with google maps loaded inside.
What would be some performance hindering differences between the native maps and one loaded from the web in a webview?
In our experience MapKit (i.e. Native) is much, much, faster and smoother that using a UIWebView containing Google Maps. It's slower to start up as all the map rendering code has to be downloaded from google's servers, and it's quite a lot slower to render as it's in a browser. Theoretically apps running in a browser can be just as fast and smooth as Native, but in actual reality this rarely happens.
Even on a iPhone 4S the difference between native and browser is noticeable. Android is even slower as, except perhaps for the very latest devices, the web browser doesn't use hardware acceleration.
If you have the choice, always go native.
There is a performance loss when using a WebView instead of a native map SDK. It's not that major though (and on faster phones it's almost unnoticeable).
The main advantage of using native API's is the fact that they have tighter integration with mobile functions such as sensors and GPS. But the disadvantage is that the native API's won't support all features the Web API does, and aren't updated as frequently as the Web API.
Very late in reply but for give my 2 cents the difference in performance came from the map management way. Using WebView you use the javascript API code as regular web page but with the difference in the android browser it seem a "reduct" set of performance since is not very responsive as standard deskop browser. Someone suggest this problem came from the limited bandwidth you have in mobile data connection. On the contrary native google api don't use javascript code and download directly map tiles and show on screen. This make much faster the app. Get map tiles is quite easy but is forbidden cause the Google TOS. You can do it only if you have an agreement with Google and, obviously, official Google app have it...
I'm looking for a platform for showing custom maps on android mobile phones and tablets.
It seems like Google's MapView is the most common (or the only?) maps platform for the Android, but my problem with it is that I can't use my own custom maps with it.
Is there any 3rd party custom maps platform for the Android? If not, can someone please try to lead me into a way to implement my own solution?
I need all the basic map features such as - Panning, zooming, layers.
I'm still very flexible with methods of how to implement my map data, so every suggestion counts!
Thanks!
OpenStreetMap supports offline and online maps. OSM API has all the features that Google Maps API has, same (almost) principles apply on OSM as they do on Google Maps.
For the #Spacedman answer, yes you can integrate the HTML that contains the js with OpenLayers in WebView
OpenLayers (mobile version) plus Javascript? Assuming you are making a mostly standalone app then I'm not sure about how well it all works running off local URLs instead of a web server, but I can't see any problems that can't be solved one way or another.
Can you tightly integrate it into Android apps? I don't know, I assume you need some kind of web page view part and send it to your HTML that uses OpenLayers javascript for the mapping...