kaidad / geo

Kaidad Geo Offline Map Prototype

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kaidad GEO - Offline Rich Content Prototype

Kaidad GEO is a prototype app demonstrating the ability to geofence rich content using offline maps. The prototype uses bundles that are downloaded to the device from a Node.js service as zip files. The zip files are expanded locally at which point the content is available offline. GPS is required to provide location information, but cell or wireless connectivity is not required as long as location services are provided by an internal or external GPS unit. The prototype is specifically targeted at tablet devices, especially iPads, but should work on any Android or iOS device.

The content bundles consist of a single GeoJSON file that includes information about the content for that bundle along with polygons delineating detailed map areas (more on that below). Take a look at one of the sample GeoJSON files included under geo/bundles, for example geo/bundles/100/bundle.json. Some of the elements are standard GeoJSON, such as "id", "title", "description", "type", "features", and "properties", while other elements are extensions used by Kaidad GEO. The extensions are all contained under "properties". Some of this information will be displayed to the user, such as the title and description. Other information is used internally to draw the map marker or to indicate if the associated narration should be played automatically when the point of interest is within some radius of the user. The media itself is described under the mediaItems node, the content of which should be self explanatory.

Offline maps are tricky to support because zoomable maps are comprised of layers of map tiles where each more detailed layer has four times the number of tiles than the previous layer. Typically, there are up to 18 zoom levels between the top most showing the entire globe, and the most detailed layer showing streets and buildings. The formula for determining the number of tiles at any given layer is 2^X * 2^Y. Adding each of these layers you'll find that there are a total of 22,906,492,245 tiles to cover the entire earth down to zoom level 18. Each map tile is typically 256 by 256 pixels, so you can see how these numbers quickly add up! See this excellent discussion on MapBox: How do web maps work?. To overcome the space issues required to support both overview and detailed maps, I employed an approach where detailed maps are bounded by a clickable polygon. Clicking on the polygon will load the map database for the detail region. A given detail region could itself contain a polygon with a more detailed region. Rather than start with the entire earth view, I started with a zoom of just North America - the idea is that the user will know ahead of time which part of the world they will be visiting. The offline maps are provided as MBTiles files, which are Sqlite db files. There is a Sqlite PhoneGap plugin provided for both iOS and Android which I originally borrowed from other sources, though I had to make various fixes and changes to them to fix performance and other issues.

When all works correctly, the app will automatically detect when the user is within the radius of a point of interest, and will play the narration associated with that point of interest, and will display the media associated with that point of interest. Being a prototype, not everything works as expected 100% of the time, and I haven't spent time to figure out why! I'll leave this up to anyone who decides to play with the prototype. As with any GitHub repo, I encourage you to contribute back to the code base if you find and fix issues.

The app is built using PhoneGap 2, so it is a cross-platform app. You'll need to be familiar with PhoneGap to really understand how everthing works, but it's not too difficult. If you aren't familiar with PhoneGap, I'd start there and get familiar enough with PhoneGap to understand the basics before diving into this prototype. This prototype uses version 2.9 of PhoneGap - version 3 is quite different! You will need to have the SDKs for whatever platforms you are targeting.

Please contact me if you're struggling with anything as I'm more than happy to help you get things going. Not knowing if anyone would find this useful or interesting, I haven't spent much time explaining things here.

About

Kaidad Geo Offline Map Prototype


Languages

Language:Objective-C 43.0%Language:JavaScript 35.1%Language:C 11.9%Language:CSS 6.6%Language:Java 2.1%Language:Shell 1.2%Language:C++ 0.1%Language:AppleScript 0.1%