-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the OpenSensorHub client library -- sQuery. sQuery is a JavaScript library modeled after jQuery. It provides API to access SOS endpoint services to gather and drill down service capabilities. Much like jQuery, plugins can be added to sQuery for different services that you may be adding.
###Accessing Capabilities of a SOS Service
var myServer = "http://<server>/<alias>";
S(myServer).getcapabilities(function(c) {
// Do something with returned capabilities XML.
// It's that simple!
});
Much like jQuery's $, S is the alias for sQuery. sQuery accepts the base URL for the SOS endpoint, which is similar to passing a selector into jQuery. S(myServer) creates a new 'instance of sQuery passing in the base SOS end point URL to the constructor.
This function makes a Get request using XMLHttpRequst to the supplied URL after adding the following query string parameters: '/sos?service=SOS&version=2.0&request=GetCapabilities'. The server responds with an capabilities XML document, which is returned to the consumer via the supplied callback as shown below:
getcapabilities: function(callback) {
if ("function" === typeof callback ) {
$.get(this.baseurl + _getCapabilitiesBase,
function(data) {
callback(data);
}, 'xml');
return this;
} else {
throw new Error("getcapabilities() :: Callback function must be provided.");
}
}