ramani
v2.0.4
Published
Ramani Maps-API, tools to consume the Ramani Cloud-services
Downloads
11
Readme
Ramani Maps-API, tools to consume the Ramani Cloud-services
Super simple to use
Ramani Maps-API is designed to be the simplest way possible to get service from Ramani Cloud.
var ramani = require('ramani');
var doAuth = ramani.init({
user:'',
apikey:'',
schema:''
});
doAuth.then(function(auth){
ramani.getTransect([
{lat:1.9720458984374998, lng:49.14758022506841},
{lat:3.5870361328124996, lng:49.337651296668845}
],{
layer: 'public.WFTXP',
info_format :'text/json'
}).then(function(transect) {
console.log(transect);
});
});
doAuth.then(function(auth){
ramani.getPoint({lat:2.3443, lng:48.8537}, {
layer: 'LAI',
dataset: 'https://analytics.ramani.ujuizi.com/goto/b5a3c1c2dd9c2b865a84a9e30654c352',
info_format :'text/json-ld',
}).then(function(res) {
console.log(res);
});
});
ramani.getMetadata('public.WFTXP',
{ item:'dates' }).then(function(res) {
console.log(res);
});
//Get RSS-feed
ramani.getMetadata('public.WFTXP',
{ item:'dates', info_format :'rss' }).then(function(res) {
console.log(res);
});
//store point
var fields = { id : '1', name : 'pointA' };
ramani.storePoint('layerID', fields, {lat:2.3443, lng:48.8537}).then(function(res) {
console.log(res);
});
//getArea
ramani.getArea([
{lat:6.25396728515625, lng:52.382305628707854},
{lat:6.372899355829467, lng:52.424196211696774},
{lat:6.257838787287611, lng:52.30345857599569},
{lat:6.638463891157568, lng:52.309025707071214}
], {
layer: 'public.WFTXP',
info_format :'text/json',
'return' :'aggregate'
}).then(function(res) {
console.log(res);
});
Table of contents
- Example
- GetMetadata
- GetTransect
- GetPoint
- GetPointCube
- GetPointProfile
- GetFeatureInfo
- GetArea
- GetVerticleProfile
- GetTimeseriesProfile
- SqlApi
- StorePoint
- StorePolygon
- StoreLine
Example
To illustrate how to use our Maps-API, we provide an example application that demonstrates some of the API methods detailed below.
git clone https://team.ujuizi.com:6443/RAMANI/Maps-api-nodejs-example.git
GetMetadata
You can call this function to get metadata from the layer.
ramani.getMetadata(layerID,
params).then(function(res) {
console.log(res);
});
note :
layerID => Replace layerID with the string name of the ID of a layer of your choice. A valid string consist of a layerID/param combination. You can obtain the layer ID/param-combination from the Layer Information-widget as part of our Digital Data Library (DDL).
For more information about which parameters you can get follow this link.
GetTransect
ramani.getTransect(coordinatesArray,
params).then(function(res) {
console.log(res);
});
note : coordinatesArray is an Array list, consisting of two coordinates for a single line or multiple coordinates for several segments.
Example: For example, atmospheric ozone along a line (single or multiple segments) crossing a city.
GetPoint
ramani.getPoint(point, bbox,
params).then(function(res) {
console.log(res);
});
note : point is consisting of one coordinate and bbox is bounding box
back to top
GetPointCube
var layerobj = [];
layerobj.push({
point : {lat:2.3443, lng:48.8537},
params : {
layer : 'public.WFTXP',
info_format : 'text/json-ld'
}
});
var grid = 3;
var radius = 0.005;
var getCube = ramani.getPointCube(layerobj, grid, radius).then(function(ret) {
$.each(ret.data, function(k, obj) {
console.log(obj.value);
});
});
note : point is consisting of one coordinate in array
back to top
GetPointProfile
var layerobj = [];
layerobj.push({
point : {lat:2.3443, lng:48.8537},
layers : ["public.WFTXP", "public.WFTXP"],
params : {
TIME : "2010-11-29T00%3A00%3A00.000Z"
}
});
var getPointProfile = ramani.getPointProfile(layerobj).then(function(ret) {
$.each(ret.data, function(k, obj) {
console.log(obj.value);
});
});
note : point is consisting of one coordinate in array for getting data in time-series, give the duration in time on the TIME parameter. eg : TIME : "2018-11-01T00:00:00.000Z/2018-11-30T00:00:00.000Z"
back to top
GetFeatureInfo
ramani.getFeatureInfo(point, bbox, {
layer: 'public.WFTXP',
info_format :'text/json',
}).then(function(ret) {
console.log(ret);
});
note : point is consisting of one coordinate and bbox is bounding box
back to top
GetArea
ramani.getArea(coordinatesArray, {
layer: 'public.WFTXP',
info_format :'text/json',
}).then(function(ret) {
console.log(ret);
});
note : point is consisting of one coordinate and bbox is bounding box
back to top
GetVerticleProfile
ramani.getVerticleProfile(point, parameters, callback);
//example
ramani.getVerticleProfile(point, {
layer: 'public.WFTXP',
info_format :'text/json',
}).then(function(ret) {
console.log(ret);
});
note : point is consisting of one coordinate
back to top
GetTimeseriesProfile
ramani.getTimeseriesProfile(point, parameters, callback);
//example
ramani.getTimeseriesProfile(point, {
layer: 'public.WFTXP',
info_format :'text/json',
}).then(function(ret) {
console.log(ret);
});
note : point is consisting of one coordinate
back to top
SqlApi
ramani.sqlApi(query, callback);
//example
ramani.sqlApi("select * from table").then(function(ret) {
console.log(ret);
});
back to top
StorePoint
var fields = { id : '1', name : 'pointA' };
ramani.storePoint('layerID', fields, point).then(function(ret) {
console.log(ret);
});
note : point is consisting of one coordinate
back to top
StorePolygon
var fields = { id : '1', name : 'pointA' };
ramani.storePolygon('layerID', fields, coordinatesArray).then(function(ret) {
console.log(ret);
});
note : coordinatesArray is an Array list, consisting of two coordinates for a single line or multiple coordinates for several segments.
back to top
StoreLine
var fields = { id : '1', name : 'pointA' };
ramani.storeLine('layerID', fields, coordinatesArray).then(function(ret) {
console.log(ret);
});
note : coordinatesArray is an Array list, consisting of two coordinates for a single line or multiple coordinates for several segments.