Skip to content

langsdlc/campus-tour

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

122 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Campus Tour

The goal of this project is to create a light-weight, mobile ready map of campus points-of-interest using open source technologies.

##Technologies

The project uses:

All code contributed by the staff members of the Jean and Alexander Heard Library is licensed under the GPLv3. Third-party code is governed by the respective licenses.

##Installation Instructions

This project runs with any web server; it does not require the use of server-side technologies (like PHP, NodeJS, etc.). The project deploys HTML and Javascript files via HTTP to the client's device. The client then requests a base map using JSONP from Mapbox and requests the points to display (again using JSONP) from Cloudant.

Project Architecture

The project does not require the installation of any database on the server. Rather, you will need accounts at both Mapbox and Cloudant to get started.

###Prerequisites

Set up an account at Mapbox and then create a new project. After you have created a base map, copy the map ID. You will need this ID to connect your project to your map.

###GeoJSON

GeoJson is the data structure through which this project is laid out. There are many different ways of formatting GeoJSON, but in order for it to function with MapBox it must match the format show below:

GeoJSON Formatting

Each point is represented as a feature and a collection of more than one point is called a "Feature Collection". Latitude and longitudes must

###Cloudant

IBM Cloudant is a hosted version of CouchDB. CouchDB is a document-oriented database that stores data as JSON, uses Javascript for writing Map/Reduce functions, and communicates with applications via HTTP. Cloundant provides a fast and easy way to get started with CouchDB without installing anything on your computer or setting up a server. These characteristics make it easy to store GeoJSON features in the "cloud" and to send those features on demand to users.

####Set Up

####Adding Points

It's easy to add individual GeoJSON features to Cloudant. To add a point, for example, click on the gear symbol on the upper right corner of your database menu list.

Imgur

Click "New Doc" and you'll generate a simple JSON document with only a single id/value pair.

Imgur

Add your GeoJSON data within this document, making sure to preserve the "_id" key/value pair at top. (You will need to add a comma to preserve the JSON syntax.) After you've added the GeoJSON data, click on "Save". Assuming that you've saved your information correctly, you'll have added your first point. Notice that you now have a "_rev" key/attribute too. CouchDB uses the "_id" and "_rev" key/value pairs for versioning so it's important not to alter them (unless you know what you're doing).

####Writing Map Functions

Map Function in Cloudant

###Mapbox

Mapbox provides an easy way to create custom maps and mapping applications. Mapbox is free to use, as long as you stay within the 100mb storage limit and under 50,000 map views. For most projects this should suffice. For this project we developed a custom mapping application. To do this, you must create a project, seelct a map, and save the project. Onced saved, click the "Project" tab, and select the "info" tab. Here you will find a "Map ID" that consists of your username and a combination of letters and numbers. This key will be added to the map.js file so that the application knows where to map your GeoJson. The [Mapbox JavaScript Library] (https://www.mapbox.com/mapbox.js/api/v2.1.9/) can be used to customize your map. This library is built on top of Leaflet, and open soure JavaSCript library. Leaflet is discussed in the next section.

###Leaflet

Leaflet is an open source JavaScript library built for creating interacrtive mobile maps.

###Bootstrap

About

Campus Historical Tour

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 66.0%
  • HTML 22.8%
  • CSS 11.2%