Add OGC SOS Observations to a Map
by openfirmware
HTML
<script src="http://canarie-sensor-rpi.github.io/geocens-js-api/javascripts/geocens.js"></script>
<link rel="stylesheet" href="http://canarie-sensor-rpi.github.io/geocens-js-api/stylesheets/leaflet.css">
<script src="http://canarie-sensor-rpi.github.io/geocens-js-api/javascripts/leaflet.js"></script>
<script src="http://canarie-sensor-rpi.github.io/geocens-js-api/javascripts/geocens-map.js"></script>
<div id="map"></div>
CSS
#map {
height: 500px;
}
JavaScript
L.Icon.Default.imagePath = "http://canarie-sensor-rpi.github.io/geocens-js-api/images";
var map = L.map('map', {
center: [51.07993, -114.131802],
zoom: 3
});
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var mapDatastream = function (datastream) {
L.geocens(datastream).addTo(map);
};
Geocens.DataService.getDatastream({
api_key: "57378dc18d74bef1051312e29a26f0b3",
sensor_id: "4ddecd5124661f9442cfca8be23f8dda",
datastream_id: "ccc92c6fe57dff592ff687d99c4ebf70",
done: mapDatastream
});