Example #1
0
func rangesHandler(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	datebegin := vars["datebegin"]
	dateend := vars["dateend"]
	filter := config.Filter{Longitude: config.IntervalInt{Min: -10000000000, Max: 1000000000}, Latitude: config.IntervalInt{Min: -1000000000, Max: 1000000000}, Accuracy: config.IntervalInt{Min: 0, Max: 9000}, Time: config.IntervalString{Min: datebegin, Max: dateend}}
	filtered := googlelocationdata.FilterValues(locations, filter)
	retval := googlelocationdata.GetmaxValues(filtered)
	json.NewEncoder(w).Encode(retval)

}
Example #2
0
func filterHandler(w http.ResponseWriter, r *http.Request) {
	log.Println("filterHandler: CALLED")
	vars := mux.Vars(r)
	longitude, _ := strconv.Atoi(vars["longitude"])
	latitude, _ := strconv.Atoi(vars["latitude"])
	width, _ := strconv.Atoi(vars["width"])
	height, _ := strconv.Atoi(vars["height"])
	datebegin := vars["datebegin"]
	dateend := vars["dateend"]

	filter := config.Filter{Longitude: config.IntervalInt{Min: longitude, Max: longitude + width}, Latitude: config.IntervalInt{Min: latitude, Max: latitude + height}, Accuracy: config.IntervalInt{Min: 0, Max: 9000}, Time: config.IntervalString{Min: datebegin, Max: dateend}}
	filtered := googlelocationdata.FilterValues(locations, filter)
	json.NewEncoder(w).Encode(filtered)
	log.Println("filterHandler: ENDED")
}