Lirael
Lirael

Reputation: 35

How to geolocate offline on a custom map, phonegap+kml


I need to write an app for mountain tourism with offline geolocation on a custom map. But I've not find a good solution.
The app needs to be for ios and android, I'm developing with Phonegap.
Is there a method to load a local KML map(or a similar file) and geolocalize the phone with gps on that local map? All without wifi or internet connections. The KML file will be inside the app and downloaded with it. Google api, earth, leaflet, bing, openlayer, mapbox and gmapify seems not work without internet connection...
If the app can reload the position of the pointer when lat and long changes it will be fanstastic!

Sorry for my bad english and thanks for help

EDIT:
I'm working with phonegap 3.3, Xcode 5.0.2, android developer tools v 22.3.0 with Eclipse 4.2.1. Work on a Mac Book pro with OS 10.8.5. In the app is also installed augmented reality with wikitude phonegap plugin

Upvotes: 1

Views: 6148

Answers (3)

DaveAlden
DaveAlden

Reputation: 30366

I've created Phonegap-based apps for Android and iOS with a very similar set of requirements to yours; offline geolocation using custom maps.

You might find this question and answer useful for the custom maps; my eventual solution was to create PNG-8 tiles of the map to keep the filesize down and I wrote a custom tiling implementation using HTML5 canvas, but you may find that something like leaflet will do this off-the-shelf.

My apps are for self-guided walks, so I use GPX route files to define the walk routes then a Javascript data structure (published from XML) to define specific locations such a direction points and points of interest, but KML may well serve you for both.

To allow my apps to continue location tracking while in the background, I used partial-wakelocks on Android. On iOS it was simpler: I just had to set the background location mode property in the project settings. Again, you might find my answer to this question useful.

On both android and iOS, I'm still using Phonegap 2.9.0 for my apps which are on the iTunes Store and on Google Play.

Hope this is of some help!

Upvotes: 2

wf9a5m75
wf9a5m75

Reputation: 6158

How about this plugin? https://github.com/wf9a5m75/phonegap-googlemaps-plugin

This plugin supports loading kml (polyline, polygon and marker only) . For offline map, TileOverlay will be help for you.

img

Upvotes: 0

Rob M.
Rob M.

Reputation: 36511

Yes it's possible, it can be accomplished any number of ways. Here is an article about accomplishing this goal with ArcGIS https://developers.arcgis.com/ios/guide/create-an-offline-map.htm

Upvotes: 0

Related Questions