diff --git a/1.8/sensoranalytics/README.md b/1.8/sensoranalytics/README.md
index 33b13b0..664ec78 100644
--- a/1.8/sensoranalytics/README.md
+++ b/1.8/sensoranalytics/README.md
@@ -131,7 +131,9 @@ Now we're all set and can use the demo.
The following sections describe how to use the demo after having installed it.
-TBD
+As a result, this is what you should see in the mapping agent Web interface:
+
+![OSM overlay with Markers](img/osm-overlay-marker.png)
## Development
diff --git a/1.8/sensoranalytics/img/osm-overlay-marker.png b/1.8/sensoranalytics/img/osm-overlay-marker.png
new file mode 100644
index 0000000..4584b47
Binary files /dev/null and b/1.8/sensoranalytics/img/osm-overlay-marker.png differ
diff --git a/1.8/sensoranalytics/mapping-agent/content/index.html b/1.8/sensoranalytics/mapping-agent/content/index.html
index 37237ed..dae5815 100644
--- a/1.8/sensoranalytics/mapping-agent/content/index.html
+++ b/1.8/sensoranalytics/mapping-agent/content/index.html
@@ -21,17 +21,21 @@
var vectorLayer = new OpenLayers.Layer.Vector("Overlay");
$.getJSON(BASE_URL + '/data', function(d) {
- console.log(d.label, d.lng, d.lat)
- // Define markers as "features" of the vector layer:
- var feature = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Point(d.lng, d.lat).transform(epsg4326, projectTo),
- {description:d.label} ,
- {externalGraphic: 'marker.png', graphicHeight: 25, graphicWidth: 21, graphicXOffset:-12, graphicYOffset:-25 }
- );
- vectorLayer.addFeatures(feature);
- });
+ for (var i = 0; i < d.length; i++) {
+ var gm = d[i]
+ console.log(gm.label, gm.lng, gm.lat)
+ if (gm.lng > 0 && gm.lat > 0) {
+ var feature = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(gm.lng, gm.lat).transform(epsg4326, projectTo),
+ {description: 'At ' + gm.timestamp + '
there were ' + gm.numvehicles + ' vehicles
in ' + gm.label + '' } ,
+ {externalGraphic: 'marker.png', graphicHeight: 25, graphicWidth: 21, graphicXOffset:-12, graphicYOffset:-25 }
+ );
+ vectorLayer.addFeatures(feature);
+ }
+ }
- map.addLayer(vectorLayer);
+ map.addLayer(vectorLayer);
+ });
//Add a selector control to the vectorLayer with popup functions
var controls = {
diff --git a/1.8/sensoranalytics/mapping-agent/data.go b/1.8/sensoranalytics/mapping-agent/data.go
index 42823e1..ea4c621 100644
--- a/1.8/sensoranalytics/mapping-agent/data.go
+++ b/1.8/sensoranalytics/mapping-agent/data.go
@@ -67,7 +67,9 @@ type MetaRecord struct {
// GeoMarker carries the data for an OSM overlay marker
type GeoMarker struct {
- Lat float64 `json:"lat"`
- Lng float64 `json:"lng"`
- Label string `json:"label"`
+ Lat float64 `json:"lat"`
+ Lng float64 `json:"lng"`
+ Label string `json:"label"`
+ TimeStamp string `json:"timestamp"`
+ VehicleCount int `json:"numvehicles"`
}
diff --git a/1.8/sensoranalytics/mapping-agent/main.go b/1.8/sensoranalytics/mapping-agent/main.go
index fb51f3e..bdd3678 100644
--- a/1.8/sensoranalytics/mapping-agent/main.go
+++ b/1.8/sensoranalytics/mapping-agent/main.go
@@ -62,8 +62,15 @@ func servecontent() {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Content-Type", "application/json")
// join with route and metrics data and create geomap overlay data
- // TBD: create slice with all the data points
- json.NewEncoder(w).Encode(lookup(t.Result.Records[0].ID))
+ gmlist := []GeoMarker{}
+ for _, record := range t.Result.Records {
+ gm := lookup(record.ID)
+ gm.TimeStamp = record.TimeStamp
+ gm.VehicleCount = record.VehicleCount
+ gmlist = append(gmlist, gm)
+ log.WithFields(log.Fields{"func": "servecontent"}).Info(fmt.Sprintf("%v", gm))
+ }
+ json.NewEncoder(w).Encode(gmlist)
})
log.WithFields(log.Fields{"func": "servecontent"}).Info("Starting app server")