Exemplo n.º 1
0
func stationKMLHandler(sdb *db.StationDB,
	w http.ResponseWriter, r *http.Request) {
	stations, err := sdb.AllStations()
	if err != nil {
		log.Printf("Station DB AllStations error: %s", err.Error())
		http.Error(w, "", http.StatusInternalServerError)
		return
	}

	err = kmlTemplate.ExecuteTemplate(w, "stations.kml", stations)
	if err != nil {
		log.Printf("Error rendering station kml map: %s", err.Error())
		http.Error(w, "", http.StatusInternalServerError)
		return
	}
}