giscloud.ready(function() {
// here we can start using GIS Cloud API methods
});
//map definition
var mapDef = {
name: map, //map name
units: "meter" //map units
};
//create map
giscloud.maps.create(mapDef)
.fail(function() {
alert("Problem with saving your map!");
return;
})
.done(function(newMapId) {
mapId = newMapId;
});
giscloud.layers.byId(8, function(layer) {
console.log(layer.mapId); //print mapId
});
// create a buffer layer for a chosen layerId
giscloud.layers.createBuffer(
17, { // buffer params, name and size are not optional
name: "buffLayer",
size: 10,
units: "mile",
mergeGeom: true,
borderWidth: 3,
borderColor: "111,121,111", // rgb string or a giscloud.Color object
fillColor: "230,34,49" // rgb string or a giscloud.Color object
}
)
.then(res => console.log("Res", res)) // if all goes well the promise
// is resolved with the new layerId
.fail(err => console.log("Err", err)); // if there's an error;
// rejected with error object
Note: adding or removing a feature from a map requires reinitialization of the map or the layer it belongs to in order to see the changes. (Check out giscloud.maps.reset or giscloud.layers.reset )
The optimal way to add more than one feature is to first add all of them and then reinitialize the current map or layer.
var pointStyle = new giscloud.GraphicStyle("point");
var pointGeom = new giscloud.geometry.Point(50, 50);
var point = new giscloud.GraphicFeature(pointGeom, pointStyle);
var featureData = {
data: {
title: "myFeature",
name: "feature 1",
message: "Feature is created!"
},
geometry: {
point
},
layerId: 733107
};
giscloud.features.create(733107, featureData);
var bounds = new giscloud.Bounds(-8007996.928, 5238368.0905, -8005498.3926, 5240264.6843);
giscloud.features.byBounds(layerId, bounds, function(features) {
console.log(features.length); //number of features
});
giscloud.features.byId(layerId, featureId, function(feature) {
console.log(feature.bounds); //feature bounds
});
var options = {
layer_id: 733107,
feature_ids: [1],
usernames: ["mapolovina"],
emails: ["marko.polovina.geof@gmail.hr"]
};
giscloud.features.email(options);
giscloud.features.byLayer(994, {
where: "name='John'",
geometry: 'wkt'
})
.done(function(features) {
console.log(features[0].geometry);
});
//table definition -> spatial data
tableDef = {
name: table, //table name (string)
geometry: "point",
srid: 4326, //EPSG:4326
columns: {
"Country": {
"type": "text"
},
"City": {
"type": "text"
}
}
};
//create table
giscloud.tables.create(tableDef)
.fail(function() {
console.log("Problems with saving your table!");
return;
})
.done(function() {
console.log("Your table is saved!");
return;
});
//table definition -> non spatial data
tableDef = {
name: table, //table name (string)
columns: {
id: {
"type": "key"
},
"Country": {
"type": "text"
},
"City": {
"type": "text"
}
}
};
//create table
giscloud.tables.create(tableDef)
.fail(function() {
console.log("Problems with saving your table!");
return;
})
.done(function() {
console.log("Your table is saved!");
return;
});
giscloud.tables.byName("building").done(out);
//time of feature creating
var query = new giscloud.Query("myTable")
.equalTo("ogc_fid", "3")
.first();
giscloud.tables.query("myTable", query)
.done(function(result) {
console.log(result.__created); //time of feature creating
});
var definition = {
name: "myForm",
title: "myFirstForm",
items: [{
type: "text",
name: "textField",
persistent: false,
required: true
},
{
type: "number",
name: "numberField",
persistent: false,
required: false
}
]
};
giscloud.forms.create("myForm", definition); //create form
giscloud.tables.rows.list("polygon")
.done(function(rows) {
console.log(parseInt(rows.total)); //print number of rows in polygon table
});
var point = new giscloud.geometry.Point(-6140.0432, 6709200.4413);
var data = {
geometry: point.toOGC(),
data: {
"attribute1": "myPoint",
"attribute2": "This is my first row."
}
};
giscloud.tables.rows.add("point", data); //add new row in 'point' table
var data = {
data: {
"attribute1": "notMyPoint"
}
};
giscloud.tables.rows.update("point", 1, data); //update row,
//(tableName, rowId/featureId, data)
giscloud.tables.rows.remove("point", 1);
var state = {
zoom: 7, //zoom level
lat: 42.057,
lng: -71.696
};
var bookmark = {
name: "bookmarkName",
map_id: 2, //mapId
state: state
};
giscloud.bookmarks.create(bookmark);
giscloud.files.list() .done(out);
giscloud.files.byPath('image.jpg', {
'expand': 'exif'
})
.done(function(image) {
console.log(image.exif);
});
giscloud.files.remove( < Number > fileId)
.done(out);
// - layer id is equal to 3100666
// - one of the attributes has a value that is equal to or contains the word "Site3"
// - * in the fields parameter means that search goes through all the attributes
giscloud.search.features("Site3", "3100666~*");
// - layer id is equal to 3100666 or 3100667
// - one of the attributes has a value that is equal to or contains the word "Site1"
// - in the layer with the layer id 3100666 only attribute site_id is searched
// - in the layer with the layer id 3100667 only attribute site_id2 is searched
// - columns metadata is returned
giscloud.search.features("Site1", "3100666~site_id;3100667~site_id2", {
columns_meta: true
});
// - layer id is equal to 3100666 or 3100667
// - one of the attributes has a value that is equal to or contains the word "Site2"
// - returned features are sorted according to the distance of the newly created
// LonLat object
// print search results (score, match and distance)
giscloud.search.features("Site2", "3100666~*;3100667~*",
new giscloud.LonLat(46.80175781249989, -19.3526108943786))
.done(function(features) {
features && features.length > 0 && features.forEach(function(feature) {
console.log(feature.searchResult);
});
});
giscloud.users.create({
username: 'username',
email: 'email',
password: 'password',
firstname: 'first name',
lastname: 'lastname'
})
.done(out);
giscloud.users.remove( < Number > userId);
.done(out);
giscloud.users.update( < Number > userId, {
email: 'email',
password: 'password',
firstname: 'first name'
})
.done(out);
Object that can have a geometry properties.
Property | Type | Description |
---|---|---|
bounds | giscloud.Bounds | Bounds of the feature. |
created | Object | Timestamp when feature has been created. |
data | Object | Raw feature data. |
geometry | Object | Geometry in one of giscloud.geometry.* types. |
id | Number | The feature id. |
layerId | Number | Id of the layer this feature belongs to. |
meta | String | Generic metadata. |
modified | Object | Modified timestamp. |
owner | Number | Id of the feature owner. |
var pointStyle = new giscloud.GraphicStyle("point");
var pointGeom = new giscloud.geometry.Point(-6140.0432, 6709200.4413);
var point = new giscloud.GraphicFeature(pointGeom, pointStyle);
var featureData = {
data: {
title: "myFeature",
name: "feature 1",
message: "Feature is created!",
attribute1: "myAttribute"
},
layerId: 733107
};
var feature = new giscloud.Feature(featureData);
feature.geometry = point;
feature.update();
Marker that can have title and content. It has a possibility to define title background color.
var lonlat = new giscloud.LonLat(lon, lat);
var text = "Marker text!";
var marker = new giscloud.FlagMarker(); //create marker
giscloud.ui.map.addMarker(marker); //add marker to map
marker.position(lonlat).content(text);
A layer on the map which can hold arbitrary geometries. Add giscloud.GraphicFeatures to this layer.
Event | Data | Description |
---|---|---|
click | MouseEvent | Fired when the user clicks any of graphic features. |
doubleClick | MouseEvent | Fired when the user double-clicks any of graphic features. |
mouseDown | MouseEvent | Fired when the user pushes the mouse button on any of graphic features. |
mouseOver | MouseEvent | Fired when the mouse enters any of graphic features. |
mouseOut | MouseEvent | Fired when the mouse leaves any of graphic features. |
Property | Type | Description |
---|---|---|
features | Object | Collection of features. |
var pointStyle = new giscloud.GraphicStyle("point");
var pointGeom = new giscloud.geometry.Point(-6140.0432, 6709200.4413);
var point = new giscloud.GraphicFeature(pointGeom, pointStyle);
viewer.graphic.add(point);
A stylable feature which can be shown on a map via the giscloud.Graphic layer.
Event | Data | Description |
---|---|---|
click | MouseEvent | Fired when the user clicks the graphic feature. |
doubleClick | MouseEvent | Fired when the user double-clicks the graphic feature. |
mouseDown | MouseEvent | Fired when the user pushes the mouse button on the graphic feature. |
mouseOver | MouseEvent | Fired when the mouse enters the graphic feature. |
mouseOut | MouseEvent | Fired when the mouse leaves the graphic feature. |
Property | Type | Description |
---|---|---|
id | String | Unique feature id |
var lineStyle = new giscloud.GraphicStyle("line");
var lineGeom = new giscloud.geometry.Line([firstPoint, secondPoint]);
var line = new giscloud.GraphicFeature(lineGeom, lineStyle); //new line with
//line style
Style for giscloud.GraphicFeature.
Property | Type | Description |
---|---|---|
border | Object | Border width. |
color | Object | Outline color. |
fill | Object | Fill color. |
shape | Object | Shape of graphic object. |
size | Object | Size width. |
var lineStyle = new giscloud.GraphicStyle("line"); //'line' is default style
var lineGeom = new giscloud.geometry.Line([firstPoint, secondPoint]);
var line = new giscloud.GraphicFeature(lineGeom, lineStyle);
var lineGraphic = {
color: new giscloud.Color(160, 160, 160, 100),
size: 1
};
var lineStyle = new giscloud.GraphicStyle(lineGraphic);
var lineGeom = new giscloud.geometry.Line([firstPoint, secondPoint]);
var line = new giscloud.GraphicFeature(lineGeom, lineStyle);
Creates a new layer. Two different types of layers are basemap layer and feature layer.
Property | Type | Description |
---|---|---|
alpha | Number | Layer opacity: 0..1 |
bounds | giscloud.Bounds | Bounds of the layer. |
columns | Object | List of layer columns. |
created | Object | Timestamp of create date. |
encoding | String | Character encoding for attributes e.g. LATIN1 |
epsg | Object | |
exportable | Boolean | Is layer exportable? |
form | Object | Layer form object. |
lock | Boolean | Is layer locked? |
mapId | Object | Id of the map to which this layer belongs. |
margin | Object | Label margin. |
modified | Object | Modified timestamp. |
name | Object | Name of the layer. |
parent | Object | Parent layer (folder). |
source | Object | Layer source. |
styles | Object | Layer style definition (symbology). |
sublayers | Object | List of sublayers. |
tooltip | Object | Render tooltips from specified attribute. |
type | Object | Layer type. |
useInfoWindow | Boolean | Use pop-up window to show identify information? |
visible | Object | Is layer visible? |
var layer = "myLayer",
table = "myTable";
//base layer definition
var layerDef = {
map_id: mapId, //write map id
name: "MapQuest OSM",
source: {
"type": "tile",
"src": "mapquest-osm"
},
type: "tile",
x_min: "-4500000.0000000",
x_max: "4500000.0000000",
y_min: "-9000000.0000000",
y_max: "9000000.0000000",
visible: true
};
//create basemap layer
var baseLayer = new giscloud.Layer(layerDef);
baseLayer.update()
.fail(function() {
alert("Problem with saving your base layer!");
return;
})
.done(function() {
//feature layer definition
layerDef.name = layer;
layerDef.type = "point";
layerDef.styles = [{
"symbol": {
"type": "circle",
"color": "9,195,0",
"border": "0,0,204",
"bw": "3",
"size": "6"
}
}];
layerDef.source = {
"type": "pg",
"src": table
};
//create feature layer
var featureLayer = new giscloud.Layer(layerDef);
featureLayer.update()
.fail(function() {
alert("Problem with saving your feature layer!");
return;
})
.done(function(newLayerId) {
layerId = newLayerId;
});
});
//feature layer definition
var layerDef = {
map_id: mapId, //write map id
name: "myLayer",
source: {
"type": "pg",
"src": "myTable"
},
type: "point",
x_min: "-4500000.0000000",
x_max: "4500000.0000000",
y_min: "-9000000.0000000",
y_max: "9000000.0000000",
visible: true
};
//layer style
layerDef.styles = [{
"symbol": {
"type": "circle",
"color": "9,195,0",
"border": "0,0,204",
"bw": "3",
"size": "6"
},
"borderwidth": "1",
"width": "3",
"fontsize": "12",
"fontname": "Arial",
"labelfield": "attribute1", //attribute
"labelplacement": "top",
"margin": "1",
"ldx": "10",
"ldy": "-10",
"clustering": true,
"showlabel": true
}];
//create feature layer
var featureLayer = new giscloud.Layer(layerDef);
featureLayer.update()
.fail(function() {
alert("Problem with saving your feature layer!");
return;
})
.done(function(newLayerId) {
console.log(newLayerId);
});
// ...
layerDef.styles = [{
"url": "https://editor.giscloud.com/rest/1/icons/shopping/book.png?color=%23006f9e&size=32",
"visible": true,
"save": true
}];
//create feature layer
var featureLayer = new giscloud.Layer(layerDef);
// ...
// ...
layerDef.styles = [{
"fontsize": "16",
"fontname": "Vedrana",
"labelfield": "attribute1",
"labelplacement": "top",
"ldx": "10",
"ldy": "-10",
"showlabel": true,
"fromlevel": "2",
"url": "https://editor.giscloud.com/rest/1/icons/shopping/book.png?color=%23006f9e&size=32",
"visible": true,
"save": true,
}];
// create feature layer
var featureLayer = new giscloud.Layer(layerDef);
// ...
// after a layer was created we can use it's
//createBuffer method to create a buffer analysis layer
var someLayer = new giscloud.Layer(layerDef);
someLayer.createBuffer({ // buffer params, name and size are not optional
name: "buffLayer",
size: 10,
units: "mile",
mergeGeom: true,
borderWidth: 3,
borderColor: "111,121,111", // rgb string or a giscloud.Color object
fillColor: "230,34,49" // rgb string or a giscloud.Color object
})
.then(res => console.log("Res", res)) // if all goes well the promise
// is resolved with the new layerId
.fail(err => console.log("Err", err)); // if there's an error;
// rejected with error object
Simple marker with only three methods. Great for showing one information per object.
var lonlat = new giscloud.LonLat(lon, lat);
var text = "Marker text!";
var marker = new giscloud.LabelMarker(); //create marker
giscloud.ui.map.addMarker(marker); //add marker to map
marker.location(lonlat).content(text);
Creates a map which contains basic informations about project.
Property | Type | Description |
---|---|---|
accessed | Object | Access timestamp. |
active | Boolean | Is the map active. |
archived | Boolean | Is the map archived. |
bgcolor | String | Map background color. e.g. #ff0000 |
bounds | Object | Stores Map bounds. |
copyright | String | Map copyright text. |
created | Object | Created timestamp. |
description | String | Map description. |
epsg | ||
id | Number | The Map id. |
maxzoom | Number | Maximum zoom scale. |
measure_unit | String | Measure units. |
modified | Object | Modified timestamp. |
name | String | Map name. |
owner | Number | Map owner id. |
proj4 | String | Projection in proj.4 format. |
resourceId | Number | Resource id. |
share | Boolean | Is map shared to the public? |
units | String | Map units e.g. degree, meter |
units_proj4 | String | Units of the proj.4 projection. |
visited | Object | Visit counter. |
wmsaccess | Boolean | Is WMS access enabled? |
var mapData = {
name: "myMap",
active: true,
owner: < number > , //user id
module: "map",
units: "meter",
tms_code: "mapquest-osm"
};
var map = new giscloud.Map(mapData); //new Map object
The most complex marker with many different options.
var lonlat = new giscloud.LonLat(lon, lat);
var text = "Marker text!";
var markerIcon = {
url: "...",
width: 0,
height: 0
};
var marker = new giscloud.Marker(); //create marker
marker.icon(markerIcon);
giscloud.ui.map.addMarker(marker); //add marker to map
marker.location(lonlat).label(text);
Defines map viewer and it's also space for showing all layers and markers.
Event | Data | Description |
---|---|---|
mouseDown | MouseEvent | Fired when the user pushes the mouse button on the viewer. |
mouseUp | MouseEvent | Fired when the user pushes the mouse button on the viewer. |
mouseMove | MouseEvent | Fired while the mouse moves over the viewer. |
dragEnd | DragEndEvent | Fired when the user stops dragging the map. |
scaleChange | ResizeEvent | Fired when the map is resized. |
boundsChange | Event | Fired when the map bounds are changed. |
featureClick | Event | Fired when the user clicks on any of features. |
featureDoubleclick | Event | Fired when the user double-clicks on any of features. |
featureOver | Event | Fired when the mouse enters any of features. |
featureOut | Event | Fired when the mouse leaves any of features. |
Property | Type | Description |
---|---|---|
activeLayer | Object | Currently active/selected layer. |
editing | Object | Is map in editing mode? |
errors | Object | List of errors. |
markers | Object | Array of markers. |
var viewer = new giscloud.Viewer("map", "mapId");
viewer.bind("mouseDown", onClick); //bind mouseDown event
function onClick(coords) {
console.log(coords);
}
//event names:
//- mouseDown
//- mouseUp
//- mouseMove
//- dragEnd
//- scaleChange
//- boundsChange
//- featureClick
//- featureDoubleClick
//- featureOver
//- featureOut
// ...
viewer.bind("mouseMove", showCoords);
function showCoords(coord) {
viewer.showTip(coord);
}
Property | Type | Description |
---|---|---|
bounds | giscloud.Bounds | Bounds of the layer. |
id | Number | The layer id. |
source | Object | Source of layer data. |
sourceId | Number | Datasource id. |
Event | Data | Description |
---|---|---|
featureAdd | Event | Fired when the feature is added. |
featureRemove | Event | Fired when the feature is removed. |
selectionClear | Event | Fired when selection is cleared. |
Property | Type | Description |
---|---|---|
ctrlDown | Boolean | Pretends to have the ctrl button down when clicking on features to select. Default is false. |
Property | Type | Description |
---|---|---|
bounds | giscloud.Bounds | Bounds of the layer. |
id | Number | The layer id. |
instance | Object | Viewer Layer instance. |
source | Object | Source of layer data. |
sourceId | Number | Datasource id. |
Property | Type | Description |
---|---|---|
giscloud.datasources.sfdc | ||
giscloud.datasources.types | ||
giscloud.datasources.wmts |
giscloud.datasources.list()
.done(function(data) {
console.log(data.total); //number of data sources
});
var data = {
name: "MyDatasource",
type: 10,
owner_id: < Number > , //userId
params: {
type: "pg"
},
epsg: 4326
};
giscloud.datasources.create(data) //create new data source
.done(function(data) {
console.log(data);
});
var data = {
name: "MyWMS",
type: 40,
params: {
url: "https://editor.giscloud.com/wms/450a77de8b3cace9fcc3c3bd39ccaa86"
}
};
giscloud.datasources.create(data) //create new data source
.done(function(data) {
console.log(data);
});
giscloud.datasources.wms
.getCapabilities("https://editor.giscloud.com/wms/346c5724511c16b7faffa35cfce2f7b6", "1.3.0")
.done(function(data) {
console.log(data.srs);
});
Property | Type | Description |
---|---|---|
copyright | String | Datasource copyright. |
description | String | Datasource description. |
epsg | Number | Projection in EPSG format. |
id | Number | Datasource id. |
name | String | Datasource name. |
owner | Number | Datasource owner id. |
params | Object | Datasource parameters. |
proj4 | String | Datasource projection in proj.4 format. |
resource_id | Number | Resource id. |
type | Number | Datasource type. |
var point = new giscloud.geometry.Point(-6140.0432, 6709200.4413); //giscloud point object
giscloud.geometry.toOGC(point);
var lonlat = new giscloud.LonLat(-6140.0432, 6709200.4413);
var options = {
srid: 900913
};
giscloud.geoutils.featuresAtPoint(lonlat, [733107, 748680], options, function(data) {
console.log(data.length); //number of features at point lonlat -> layer 733107
//and 748680
});
var gcPolygon = giscloud.geometry.fromOGC(
"POLYGON ((1788874.8822150454 5752001.034001928,1790728.480150964 5752516.983942853,1790766.6986651048" +
"5753520.219939096,1788913.1007291898 5753778.194909558,1788406.7054168023 5753615.766224453,1788874.8822150454 5752001.034001928))"
);
// srid: any EPSG
// operation: within|outside|intersect (default if not specified)
giscloud.geoutils.spatialFilter(gcPolygon, [ < layer_id1 > , < layer_id2 > , ...], {
srid: 900913,
operation: "within"
}).done(out);
giscloud.geoutils.spatialFilter(JSON.stringify({
"1071": [8]
}), [1078], {
operation: "within"
})
.done(function(e) {
console.log(e.length);
});
//9->first layer id, 8->first feature id, 10->second layer id, 1->second feature id
giscloud.spatialrelationship.within(9, 8, 10, 1)
.done(function(onoff) {
console.log(onoff); //prints true or false -> if it's true,
//feature 8 is within feature 1
});
Property | Type | Description |
---|---|---|
geometries | Object | giscloud.geometry.* objects contained in this GeometryCollection. |
Property | Type | Description |
---|---|---|
points | Object | Array of giscloud.geometry.Point contained in this Line. |
var line = new giscloud.geometry.Line(listOfPoints);
Property | Type | Description |
---|---|---|
lines | Object | Array of giscloud.geometry.Line contained in this Multiline. |
var multiline = new giscloud.geometry.Multiline(listOfLines);
Property | Type | Description |
---|---|---|
points | Object | Array of giscloud.geometry.Point contained in this Multipoint. |
var multipoint = new giscloud.geometry.Multipoint(listOfPoints);
Property | Type | Description |
---|---|---|
polygons | Object | Array of giscloud.geometry.Polygon contained in this Multipolygon. |
var multipolygon = new giscloud.geometry.Multipolygon(listOfPolygons);
Property | Type | Description |
---|---|---|
x | Object | X value. |
y | Number | Y value. |
var point = new giscloud.geometry.Point(lon, lat, z);
Property | Type | Description |
---|---|---|
rings | Object | Array of giscloud.geometry.Line contained in this Polygon. |
var polygon = new giscloud.geometry.Polygon(rings);
Property | Type | Description |
---|---|---|
options | Object | Options parameter in query object. |
new giscloud.Query("myTable")
.where("ogc_fid", ">", 3)
.first()
.done(function(record) {
console.log(record);
});
var c = new giscloud.Color(255, 0, 0);
c.hex() // "#FF0000"
c.hex("0x") // "0xFF0000"
c.hex("HEX:") // "HEX:FF0000"
c.hex("") // "FF0000"
Geographical bounds, an extent.
Property | Type | Description |
---|---|---|
bottom | Number | Bottom boundary. |
left | Number | Left boundary. |
right | Number | Right boundary. |
top | Number | Top boundary. |
var bounds = new giscloud.Bounds(-8007996.928, 5238368.0905,
-8005498.3926, 5240264.6843);
bounds.center().toString(); //returns center of the bounds
bounds.height().toString(); //returns height of the bounds
bounds.width().toString(); //returns width of the bounds
bounds.isPoint(); //false
bounds.valid(); //true
This object is prototype for giscloud.geometry.*.
var numberOfDays = giscloud.date.daysInMonth(7, 2014);
parseInt(numberOfDays); //return number of days in July, 2014 year
Property | Type | Description |
---|---|---|
giscloud.formats.GML | GML vector format. | |
giscloud.formats.GPX | GPX vector format. | |
giscloud.formats.HTML | HTML format. | |
giscloud.formats.IFRAME | Iframe format. | |
giscloud.formats.JPEG | JPEG image format. | |
giscloud.formats.MIF | MapInfo vector format. | |
giscloud.formats.PNG | PNG image format. | |
giscloud.formats.SHAPEFILE | Shapefile vector format. |
Property | Type | Description |
---|---|---|
giscloud.formats.exportFormats.GML | GML vector format. | |
giscloud.formats.exportFormats.GPX | GPX vector format. | |
giscloud.formats.exportFormats.MIF | MapInfo vector format. | |
giscloud.formats.exportFormats.SHAPEFILE | Shapefile vector format. |
Property | Type | Description |
---|---|---|
giscloud.formats.renderFormats.IFRAME | Iframe HTML output. | |
giscloud.formats.renderFormats.JPEG | JPEG image format. | |
giscloud.formats.renderFormats.PNG | PNG image format. |
var options = {
perpage: 5,
page: 1
};
giscloud.layers.attributeOps.distinct(733107, "attribute1", options)
.done(function(data) {
console.log(data.data); //list of attribute values
});
Simple point with only position properties.
Property | Type | Description |
---|---|---|
lat | Number | Latitude |
lon | Number | Longitude |
var lonlat = new giscloud.LonLat(3, 5);
lonlat.lon.toString(); //return longitude -> "3"
lonlat.lat.toString(); //return latitude -> "5"
var lonlat_first = new giscloud.LonLat(3, 5);
var lonlat_second = new giscloud.LonLat(5, 3);
lonlat_first.equals(lonlat_second); //return false
var lonlat = new giscloud.LonLat(11, 17);
lonlat.transform(4326, 900913);
function httpStatus(response) {
console.log(response.http_status); //print http status
}
giscloud.proxy.call("www.giscloud.com", httpStatus);
Property | Type | Description |
---|---|---|
formHasDependencies | Boolean | |
formHasEnvDependencies | Boolean | |
formHasItemDependencies | Boolean | |
itemIndex | Object | |
items | Object | |
triggArray | Object |
This object is equal to jQuery promise() object. Description from jQuery official page: 'Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.' (web page: https://api.jquery.com/promise/).
Property | Type | Description |
---|---|---|
app_instance_id | Object | |
app_role | Boolean | |
id | ||
name | ||
owner_id | Object | |
parent_id | Object |
giscloud.keys.add("write_some_description");
The GIS Cloud API uses the OAuth 2.0 protocol for user authentication. This means you can have your custom built apps access data which is private to your GIS Cloud account. To authorize such access you must first obtain a client id from the GIS Cloud application.
// clientId is generated by GIS Cloud, you can make your own application on
// My Account -> API access -> Applications
giscloud.oauth2.authorize(clientId, function() {
giscloud.oauth2.button("login");
});
Property | Type | Description |
---|---|---|
giscloud.permissions.DELETE | Delete permission. | |
giscloud.permissions.DELETE_MDC | Delete MDC permission. | |
giscloud.permissions.EDIT | Edit (write) permission. | |
giscloud.permissions.EDIT_MOBILE | Edit (write) mobile permission. | |
giscloud.permissions.EDIT_WITH_SHARE | Edit permission + sharing permission. | |
giscloud.permissions.EXPORT | Export permission. | |
giscloud.permissions.INSERT | Insert permission. | |
giscloud.permissions.INSERT_MDC | Insert MDC permission. | |
giscloud.permissions.OWNER | Owner permission. | |
giscloud.permissions.READ | Read-only permission. | |
giscloud.permissions.SHARE | Share permission. | |
giscloud.permissions.UPDATE | Update permission. | |
giscloud.permissions.UPDATE_MDC | Update MDC permission. |
Property | Type | Description |
---|---|---|
giscloud.ui.datagridDrawer | ||
giscloud.ui.homepage | ||
giscloud.ui.map | giscloud.Viewer | Instance of the main map viewer. |
giscloud.ui.ready | ||
giscloud.ui.reports | ||
giscloud.ui.resources | ||
giscloud.ui.upload |
giscloud.ui.checkLogin(); //return true or false
giscloud.ui.greenAlert("I'm green alert!", 1000);
Options for default tools are: - instant (if true this tool will just run the activation function when activated, no event is triggered) - actions (functions which will handle tool actions) -> activation (activation function) -> deactivation (deactivation function) - styles (style options) -> caption (visible text for the tool or alt text if icons are used) -> showCaption (if true, the caption will be visible) -> cssClass (css class for the tool, .gc-tool is the default class) -> active (css class for an active tool, .gc-tool-active is the default class) -> hover (css class for the tool hover event, .gc-tool-hover is the default class) - icon (src for the icon image) -> iconActive (src for the active icon image) -> iconHover (src for the hover icon image) - toolbar (if the tooolbar is set through options, after the tool is added to that toolbar it will not be rendered, instead you should call the tool's
Event | Data | Description |
---|---|---|
row-select.gc-feature-datagrid | MouseEvent | Fired when the user clicks on row. |
header-click.gc-feature-datagrid | MouseEvent | Fired when the user clicks on header. |
reload-before.gc-feature-datagrid | MouseEvent | Fired before reload. |
reload-after.gc-feature-datagrid | MouseEvent | Fired after reload. |
Property | Type | Description |
---|---|---|
loaded | Object |
var viewer = new giscloud.Viewer("mapViewer", < mapId > ),
featuregrid = new giscloud.ui.FeatureDatagrid( < elementId > , {
viewer: viewer,
activeLayerId: < layerId > ,
datagridOpts: {
"ordering": true
},
orderBy: {
orderByLayerId: < layerId > ,
orderByExpression: < condition >
}
});
Property | Type | Description |
---|---|---|
loaded | Object |
Event | Data | Description |
---|---|---|
toolChange | Event | Fired when the tool selection is changed. |
Property | Type | Description |
---|---|---|
tools | Object | Contains all tools in the toolbar. |
viewer | Reference to a Viewer that is connected with this toolbar. |
var viewer = new giscloud.Viewer("map", "mapId"); //creates viewer in 'map'
//container
var toolbar = new giscloud.ui.Toolbar({
viewer: viewer,
container: "toolbar", //creates toolbar in 'toolbar' container
defaultTools: ["pan", "zoom", "full", "measure", "select"] //some of default
//tools
});
//tool will show mouse coordinate in marker
//when you click on viewer
var marker, newIcon = {
url: "...",
width: 0,
height: 0
};
// ...
//add your own tool in toolbar
myFirstTool = new giscloud.ui.Toolbar.Tool(
//tool name
"myTool",
//tool options
{
styles: {
caption: "Show coords",
showCaption: true,
cssClass: "myTool",
active: "mytool-hover"
},
actions: {
activation: function(viewer) {
viewer.bind("mouseDown", showCoords);
},
deactivation: function(viewer) {
var markersList, i;
viewer.unbind("mouseDown", showCoords);
markersList = viewer.markers;
for (i = 0; i < markersList.length; i++) {
markersList[i].visible(false);
}
marker = null;
}
}
}
//add tool
toolbar.add(myFirstTool);
);
// ...
function showCoords(coord) {
//create new marker
if (!marker) {
marker = new giscloud.Marker();
marker.icon(newIcon);
viewer.addMarker(marker);
}
marker.location(coord).label("lon:" + coord.lon + " lat:" + coord.lat);
}