func (uc LocationController) RemoveLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
	//  removes an existing location resource
	id := p.ByName("location_id")

	if !bson.IsObjectIdHex(id) {
		w.WriteHeader(404)
		return
	} // Verify id is ObjectId, otherwise bail

	oid := bson.ObjectIdHex(id)

	if err := uc.session.DB("go_273").C("Locations").RemoveId(oid); err != nil {
		w.WriteHeader(404)
		return
	} // Remove user

	w.WriteHeader(200)
}
func (uc LocationController) UpdateLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
	var i InputAddress
	var o OutputAddress

	id := p.ByName("location_id")

	if !bson.IsObjectIdHex(id) {
		w.WriteHeader(404)
		return
	}
	oid := bson.ObjectIdHex(id)

	if err := uc.session.DB("go_273").C("Locations").FindId(oid).One(&o); err != nil {
		w.WriteHeader(404)
		return
	}

	json.NewDecoder(r.Body).Decode(&i)

	googResCoor := getGoogLocation(i.Address + "+" + i.City + "+" + i.State + "+" + i.Zip)
	fmt.Println("resp is: ", googResCoor.Coordinate.Lat, googResCoor.Coordinate.Lang)

	o.Address = i.Address
	o.City = i.City
	o.State = i.State
	o.Zip = i.Zip
	o.Coordinate.Lat = googResCoor.Coordinate.Lat
	o.Coordinate.Lang = googResCoor.Coordinate.Lang

	c := uc.session.DB("go_273").C("Locations")

	id2 := bson.M{"_id": oid}
	err := c.Update(id2, o)
	if err != nil {
		panic(err)
	}

	uj, _ := json.Marshal(o)

	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(201)
	fmt.Fprintf(w, "%s", uj)
}
func (uc LocationController) GetTrip(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
	// GetTrip retrieves an individual trip resource
	id := p.ByName("trip_id")

	if !bson.IsObjectIdHex(id) {
		w.WriteHeader(404)
		return
	}

	oid := bson.ObjectIdHex(id)
	var tO TripPostOutput
	if err := uc.session.DB("go_273").C("Trips").FindId(oid).One(&tO); err != nil {
		w.WriteHeader(404)
		return
	}
	uj, _ := json.Marshal(tO)

	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(200)
	fmt.Fprintf(w, "%s", uj)
}
func (uc LocationController) GetLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
	// GetLocation retrieves an individual location resource
	id := p.ByName("location_id")

	if !bson.IsObjectIdHex(id) {
		w.WriteHeader(404)
		return
	}

	oid := bson.ObjectIdHex(id)
	var o OutputAddress
	if err := uc.session.DB("go_273").C("Locations").FindId(oid).One(&o); err != nil {
		w.WriteHeader(404)
		return
	}

	uj, _ := json.Marshal(o)
	// Marshal interface into JSON structure
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(200)
	fmt.Fprintf(w, "%s", uj)
}