giscloud

Methods

  • giscloud.apiKey(<String> apiKey)Gets or sets API key.Returns: set:this, get:String
  • giscloud.appInstanceId()
  • giscloud.escapeSelector()
  • giscloud.exposeJQuery()Returns built-in jQuery object.Returns: jQuery Object
  • giscloud.exposeLeaflet()Returns built-in Leaflet object.Returns: Leaflet Object
  • giscloud.fromMeters(<String> unit, <Number> value)Returns new value in written units.Returns: Number
  • giscloud.fromSquareMeter(<String> unit, <Number> value)Returns new value in written units.Returns: Number
  • giscloud.help()Returns built in help. Use giscloud.help.load() to enable help on all methods, classes and namespaces.Returns: String
  • giscloud.includeCss(<String> URL, <Function> callbackOptional)Dynamically includes a CSS. Upon finish it can call a callback function.Returns: giscloud.Promise
  • giscloud.includeJs(<String> URL, <Function> callbackOptional)Dynamically includes a JavaScript. Upon finish it can call a callback function.Returns: giscloud.Promise
  • giscloud.offlineMode(<Boolean> onoff)Turns offline mode on/off.Returns: set:this, get:
  • giscloud.ready(<Function> callback)Calls callback function once the API is ready to be used.Returns: this
  • giscloud.rpc()
  • giscloud.sessid(<Function> callback)Returns current session ID.Returns: String
  • giscloud.toMeters(<String> unit, <Number> value)Returns new value in meters.Returns: Number
  • giscloud.uuid()Returns globally-unique identifier in JavaScript.Returns:
  • giscloud.xssSafe(<String> text)Returns jQuery object with text parameter.Returns: jQuery object

GIS Cloud API

giscloud.ready(function() {
    // here we can start using GIS Cloud API methods
});

giscloud.maps

Methods

  • giscloud.maps.archive(<Number> mapId)Archives map by specified mapIdReturns: giscloud.Promise
  • giscloud.maps.byId(<Number> mapId, <Function> callback)This method will retrieve map data for a specified map id.Returns: giscloud.Promise
  • giscloud.maps.create(<Object> data)This creates a new map. Input is object containing map data. See the data returned using methods like giscloud.maps.byId to see a sample of data.Returns: giscloud.Promise
  • giscloud.maps.list(<Object> optionsOptional, <Function> callback)This method grabs a list of maps from GIS Cloud and passes it to the callback function.Returns: giscloud.Promise
  • giscloud.maps.remove(<Number> mapId)Deletes map mapIdReturns: giscloud.Promise
  • giscloud.maps.reset(<Number> mapId, <Number> layerIds)Reinitializes (tiles) for layer layerIds in a map mapId.Returns: giscloud.Promise
  • giscloud.maps.restore(<Number> mapId)Restores map by specified mapIdReturns: giscloud.Promise
  • giscloud.maps.update(<Number> mapId, <Object> data)Use this method to update a map already in the cloud.Returns: giscloud.Promise
  • giscloud.maps.users(<Number> mapId)Returns list of users that have access to map mapId.Returns: giscloud.Promise

Create new map object

//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

Methods

  • giscloud.layers.byId(<Number> layerId, <Function> callback)This method will retrieve layer data for a specified layer id.Returns: giscloud.Promise
  • giscloud.layers.byMapId(<Number> mapId, <Function> callback)This method fetches a list of layers belonging to the specified map from GIS Cloud and passes it to the callback function.Returns: giscloud.Promise
  • giscloud.layers.create(<Object> data)This creates a new layer. Input is object containing layer data. See the data returned using methods like giscloud.layers.byId to see a sample of data.Returns: giscloud.Promise
  • giscloud.layers.createBuffer(<Number> layerId, <Object> buffer params)Creates a buffer layer. Name and size are required buffer params. Resolves with layerId.Returns: Deferred object
  • giscloud.layers.export(<Number> layerId, <String> exportFormat, <Boolean> zip)Returns URL that can be used to export layerId into an exportFromatReturns: String("URL")
  • giscloud.layers.list(<Function> callback)This method fetches a list of layers from GIS Cloud and passes it to the callback function.Returns: giscloud.Promise
  • giscloud.layers.refreshColumns()
  • giscloud.layers.remove(<Number> layerId)Deletes layer layerIdReturns: giscloud.Promise
  • giscloud.layers.render(<Number> layerId, <String> format, <Number> width, <Number> height)Returns URL that can be used to render layerId as an png, iframeReturns: String("URL")
  • giscloud.layers.reset(<Number> mapId, <Number> layerId)Reinitializes (tiles) for layer layerId in a map mapId.Returns: giscloud.Promise
  • giscloud.layers.update(<Number> layerId, <Object> data)Use this method to update a layer already in the cloud.Returns: giscloud.Promise
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

giscloud.features

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.

Methods

  • giscloud.features.byBounds(<Number> layerId, <giscloud.Bounds> bounds, <Function> callback)This method fetches a list of features belonging to the specified layer within provided bounds from GIS Cloud and passes it to the callback function.Returns: giscloud.Promise
  • giscloud.features.byId(<Number> layerId, <Number> featureId, <Object> optionsOptional, <Function> callback)This method will retrieve feature data for a specified feature id.Returns: giscloud.Promise
  • giscloud.features.byLayer(<Number> layerId, <Object> options, <Function> callback)This method fetches a list of features belonging to the specified layer from GIS Cloud and passes it to the callback function.Returns: giscloud.Promise
  • giscloud.features.create(<Number> layerId, <Object> data)This creates a new feature in a desired layer. Input is object containing feature data. The geometry property sets the geometry; use WKT here.Returns: giscloud.Promise
  • giscloud.features.email(<Object> options)Email features to usernames and/or emails. Options: layer_id, feature_ids (Array), usernames (Array), emails (Array)Returns: giscloud.Promise
  • giscloud.features.emailCSV(<Object> options)Email features.csv to emails. Options: layer_id and emails (Array).Returns: giscloud.Promise
  • giscloud.features.remove(<Number> layerId, <Number> featureId)Deletes feature featureId from layer layerId.Returns: giscloud.Promise
  • giscloud.features.update()Use this method to update a feature i.e. to save changes to the cloud. If this is a new feature without the ID, a new feature will be created.Returns: giscloud.Promise

Create new feature

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
});

Send feature properties on mail

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);
    });

giscloud.tables

Methods

  • giscloud.tables.byName(<String> tableName)Retrieves table schema by name.Returns: giscloud.Promise
  • giscloud.tables.create(<Object> tableSchema)Creates a new table.Returns: giscloud.Promise
  • giscloud.tables.export()
  • giscloud.tables.join(<String> source, <String> target, <String> viewName, <String> on, <Object> idFields, <String> fields, <String> joinType)Creates a new table join.Returns: giscloud.Promise
  • giscloud.tables.list(<Object> options)Lists table schemas.Returns: giscloud.Promise
  • giscloud.tables.query(<String> tableName, <giscloud.Query> query)Executes a giscloud.Query on table.Returns: giscloud.Promise
  • giscloud.tables.remove(<String> tableName)Deletes a table.Returns: giscloud.Promise
  • giscloud.tables.reset()

Create giscloud table object with spatial data

//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;
    });

Create giscloud table object with non spatial data

//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;
    });

Search table by name

giscloud.tables.byName("building").done(out);

Find feature whose FID value is equal to 3 and print

//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
    });

giscloud.forms

Methods

  • giscloud.forms.byId(<Number> formId, <Object> options)Search form by form id.Returns: this
  • giscloud.forms.byLayerAndId(<Number> layerId, <Number> formId, <Object> options)Search form by layer and form id.Returns: this
  • giscloud.forms.create(<String> name, <Object> definition)Creates a new form. Form is defined in a JSON structure.Returns: giscloud.Promise
  • giscloud.forms.remove(<Number> formId)Deletes form formId.Returns: giscloud.Promise
  • giscloud.forms.setLayerMappings(<Number> layerId, <Number> formId, <Object> mappings)Maps form formId to a layer layerId with defined mappingsReturns: giscloud.Promise
  • giscloud.forms.update(<Number> formId, <String> name, <Object> definition)Updates form formId with a new name and JSON definition.Returns: giscloud.Promise

Create new form

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

Methods

  • giscloud.tables.rows.add(<String> tableName, <Object> data, <Object> options)Adds a new row.Returns: giscloud.Promise
  • giscloud.tables.rows.list(<String> name, <Object> options)Lists rows for chosen table.Returns: giscloud.Promise
  • giscloud.tables.rows.remove(<String> name, <Number> id)Removes row.Returns: giscloud.Promise
  • giscloud.tables.rows.update(<String> name, <Number> id, <Object> data, <Object> options)Updates row with new data.Returns: giscloud.Promise

List rows in polygon table

giscloud.tables.rows.list("polygon")
    .done(function(rows) {
        console.log(parseInt(rows.total)); //print number of rows in polygon table
    });

Add a new row in point 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

Update row in point table

var data = {
    data: {
        "attribute1": "notMyPoint"
    }
};
giscloud.tables.rows.update("point", 1, data); //update row,
//(tableName, rowId/featureId, data)

Remove row

giscloud.tables.rows.remove("point", 1);

giscloud.bookmarks

Methods

  • giscloud.bookmarks.byMapId(<Number> mapId, <Object> options, <Function> callback)Gets bookmarks in a map.Returns: giscloud.Promise
  • giscloud.bookmarks.create(<Object> bookmark)Creates a new bookmark.Returns: giscloud.Promise
  • giscloud.bookmarks.list(<Object> options)List bookmarks.Returns: giscloud.Promise
  • giscloud.bookmarks.remove(<Number> bookmarkId)Deletes a bookmark.Returns: giscloud.Promise

Create new bookmark

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

Methods

  • giscloud.files.byId(<Number> fileId)Get file info by file id.Returns: giscloud.Promise
  • giscloud.files.byPath(<String> filePath)Get file info by file path.Returns: giscloud.Promise
  • giscloud.files.create(<Object> data)Create new file.Returns: giscloud.Promise
  • giscloud.files.list()List all files and their info.Returns: giscloud.Promise
  • giscloud.files.remove(<Number> fileId)Remove file by file id.Returns: giscloud.Promise
  • giscloud.files.update(<Number> fileId, <Object> data)Update file by file id.Returns: giscloud.Promise

List all files

giscloud.files.list()
    .done(out);

Get an image file and print image metadata object

giscloud.files.byPath('image.jpg', {
        'expand': 'exif'
    })
    .done(function(image) {
        console.log(image.exif);
    });

Remove file by file id

giscloud.files.remove( < Number > fileId)
    .done(out);

giscloud.search

Methods

  • giscloud.search.features(<String> query, <String> fields, <giscloud.LonLat> location, <Object> options, <Function> callback)Returns list of features using a text based search.Returns: giscloud.Promise

Find features with these conditions:

//    - 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~*");

Find features with these conditions:

//    - 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
});

Find features with these conditions:

//    - 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

Methods

  • giscloud.users.byId(<Number> userId)Get GIS Cloud user data by his user id.Returns: giscloud.Promise
  • giscloud.users.create(<Object> userData)Create new GIS Cloud user. Object params are: <String> username, <String> email, <String> password, <String> firstName, <String> lastName.Returns: giscloud.Promise
  • giscloud.users.current()Get GIS Cloud user data that is currently logged in.Returns: giscloud.Promise
  • giscloud.users.list()List all users that are created by current user.Returns: giscloud.Promise
  • giscloud.users.remove(<Number> userId)Remove user by his user id.Returns: giscloud.Promise
  • giscloud.users.unsubscribe(<Number> userId, <Number> subscriptionId)Unsubscribe user subscription by subscription id.Returns: giscloud.Promise
  • giscloud.users.update(<Number> userId, <Object> userData)Update GIS Cloud user data by user id.Returns: giscloud.Promise

Create new GIS Cloud user

giscloud.users.create({
        username: 'username',
        email: 'email',
        password: 'password',
        firstname: 'first name',
        lastname: 'lastname'
    })
    .done(out);

Remove GIS Cloud user

giscloud.users.remove( < Number > userId);
.done(out);

Update GIS Cloud user by user id

giscloud.users.update( < Number > userId, {
        email: 'email',
        password: 'password',
        firstname: 'first name'
    })
    .done(out);

giscloud.Feature

Object that can have a geometry properties.

Constructor

  • giscloud.Feature(featureData)This constructor is passed an object with raw data for the feature. The common way to retrieve layer data is to use the giscloud.features object.Returns: new giscloud.Feature({...})

Methods

  • clone()Makes a new feature object which is a clone of the original. Call update on the new feature to save it to the cloud. It is necessary to have feature's geometry defined to actually see the feature on the map.Returns: giscloud.Feature
  • remove()Removes this feature.Returns: giscloud.Promise
  • update(<Object> options)Updates changes made to this feature.Returns: giscloud.Promise

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.

Create new feature

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();

giscloud.FlagMarker

Marker that can have title and content. It has a possibility to define title background color.

Constructor

  • giscloud.FlagMarker(<giscloud.LonLat> position, <String> title, <String> content, <giscloud.Color> color)Makes a new Flag marker.Returns: new giscloud.FlagMarker()

Methods

  • color(<giscloud.Color> colorOptional)Gets or sets the color of the flag marker. If the color argument is provided, the FlagMarker object is returned; if omitted, the method returns the current marker color as a giscloud.Color object.Returns: set:this, get:String
  • content(<String> content)Gets or sets the content of the flag marker. If the content argument is provided, the FlagMarker object is returned; if omitted, the method returns the current marker content.Returns: set:this, get:String
  • position(<giscloud.LonLat> posOptional)Gets or sets the position of the flag marker. If the pos argument is provided, the FlagMarker object is returned; if omitted, the method returns the marker's current location as a giscloud.LonLat object.Returns: set:this, get:String
  • title(<String> title)Gets or sets the title of the flag marker. If the title argument is provided, the FlagMarker object is returned; if omitted, the method returns the current title.Returns: set:this, get:String
  • visible(<Boolean> onoff)Gets or sets the visibility of the flag marker.Returns: set:this, get:Boolean

Create new flag marker

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);

giscloud.Graphic

A layer on the map which can hold arbitrary geometries. Add giscloud.GraphicFeatures to this layer.

Constructor

  • giscloud.Graphic()Default constructorReturns: new giscloud.Graphic()

Methods

  • acceptDraw()Checks if drawing mode is on.Returns: this
  • add(<giscloud.GraphicFeature> feature)Adds a graphic feature to the layer.Returns: this
  • bind(<String> eventName, <Function> handler)Binds an event handler.Returns: this
  • cancelDraw()Cancels drawing mode.Returns: this
  • clear()Clears the layer.Returns: this
  • draw(<String> type, <Function> drawEndCallback, <Function> drawCancelCallback)This starts the drawing on the viewer graphic layer. Type can be point, line or polygon. The drawing ends on a doubleclick, right click and "end draw", or when another draw command is issued either to start a new drawing or to just end the current one. The last is done by calling graphic.draw(false).Returns: giscloud.Promise
  • edit(<giscloud.GraphicFeature> graphicFeature)Starts editing a graphic feature.Returns: giscloud.Promise
  • editAccept()Accepts the changes.Returns: this
  • editCancel()Cancels the change.Returns: this
  • editedFeature()
  • exists(<giscloud.graphicFeature> graphicFeature)Returns index of graphic feature.Returns:
  • isFeatureCountOkForSnapping()Checks if number of features is less then 10000.Returns: Boolean
  • measureDisplay(<Boolean> onoff)Choose if you want to display measures.Returns: this
  • remove(<giscloud.GraphicFeature> feature)Removes graphic feature from the layer.Returns: this
  • setId(<giscloud.GraphicFeature> graphicFeature, <Number> newId)Method changes graphic feature id.
  • snapToLayersGeometry(<true/false> options)Method starts snapping mode.Returns: this
  • unbind(<String> eventName, <Function> handler)Unbinds an event handler.Returns: this

Events

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.

Properties

Property Type Description
features Object Collection of features.

Add point to graphic layer

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);

giscloud.GraphicFeature

A stylable feature which can be shown on a map via the giscloud.Graphic layer.

Constructor

Methods

  • bind(<String> eventName, <Function> handler)Binds an event handler.Returns: this
  • geometry(<giscloud.geometry.undefined)Returns: Get or sets geometry in one of the giscloud.geometry.* types.
  • remove(<Number> id)Removes graphic feature.Returns:
  • style(<giscloud.GraphicStyle> styleOptional)Gets or sets feature style.Returns: set:this, get:giscloud.GraphicStyle
  • toDataObject()Returns graphic feature in form of data object.Returns: Object
  • toOGC()Gets a geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT
  • unbind(<String> eventName, <Function> handler)Unbinds an event handler.Returns: this
  • update(<Number> id, <Object> data)Updates graphic feature with new data.Returns: this
  • visibility(<Boolean> onoff)Turns feature visibility on/off.Returns: set:this, get:

Events

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.

Properties

Property Type Description
id String Unique feature id

Create new line with line style

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

giscloud.GraphicStyle

Style for giscloud.GraphicFeature.

Constructor

  • giscloud.GraphicStyle(<String> argument | <Object> argument)Defines style for feature display. <String> arguments can be 'point', 'line' and 'polygon'. <Object> properties contains color, fill and size params.Returns: new giscloud.GraphicStyle()

Methods

  • stringify()Returns graphic style object in form of string.Returns: String

Properties

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.

Create new line and show that line with default 'line' style

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);

Create new line and show that line with created style

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);

giscloud.Layer

Creates a new layer. Two different types of layers are basemap layer and feature layer.

Constructor

  • giscloud.Layer(<Object> data)Creates a new layer.Returns: new giscloud.Layer()

Methods

  • clone()Makes a new layer object which is a clone of the original. Call update on the new layer to save it to the cloud.Returns: giscloud.Layer
  • copyStylesFrom(<Number> layerId)Copies styles from an existing layer.Returns: giscloud.Layer
  • createBuffer(<Object> buffer params)Creates a buffer layer. Name and size are required buffer params. Resolves with layerId.Returns: Deferred object
  • remove()Removes this layer.Returns: giscloud.Promise
  • reset()Reinitializes this layer (tiles).Returns: giscloud.Promise
  • update()Updates changes made on this layer.Returns: giscloud.Promise

Properties

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?

Create new basemap layer and feature layer

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;
            });

    });

Create new feature layer

//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);
    });

Example for layer style

// ...
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);
// ...

Example for layer style

// ...
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);
// ...

Example for buffer layer

// 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

giscloud.LabelMarker

Simple marker with only three methods. Great for showing one information per object.

Constructor

  • giscloud.LabelMarker(<giscloud.LonLat> location, <Object> options)Makes a new Label marker. Options are <String> content and <Boolean> visible.Returns: new giscloud.LabelMarker()

Methods

  • content(<String> content)Gets or sets marker content.Returns: set:this, get:
  • location(<giscloud.LonLat> location)Gets or sets marker location.Returns: set:this, get:
  • visible(<Boolean> visible)Gets or sets marker visibility.Returns: set:this, get:

Create new label marker

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);

giscloud.Map

Creates a map which contains basic informations about project.

Constructor

  • giscloud.Map()Creates a new giscloud.Map object.Returns: new giscloud.Map()

Methods

  • archive()Archives this map.Returns: giscloud.Promise
  • clone()Creates a new giscloud.Map object with the same values as the original.Returns: A new giscloud.Map object.
  • iframeUrl(<Number> width, <Number> height)Returns an URL of the IFRAME embeddable map. Options { toolbar:boolean, layerlist:boolean }Returns: String("URL")
  • imageUrl(<Number> width, <Number> heigh)Returns an URL of a map PNG image.Returns: String("URL")
  • refresh(<Function> callback, <Boolean> refreshLayers)Refreshes map data.Returns: this
  • refreshLayers(<Function> callback)Refreshes layers data.Returns: this
  • remove()Removes this map.Returns: giscloud.Promise
  • reset()Reinitializes this map (tiles).Returns: giscloud.Promise
  • restore()Restores this map.Returns: giscloud.Promise
  • update()Updates changes made on this map.Returns: giscloud.Promise
  • users()Returns list of users that have access to this map.Returns: giscloud.Promise

Properties

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?

Create Map object

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

giscloud.Marker

The most complex marker with many different options.

Constructor

  • giscloud.Marker(<giscloud.LonLat> location, options)Makes a new marker. Options are <String> title, <String> content, <Boolean> visible, <Object> icon, <String> label, <Number> rotation, <Boolean> popup and <giscloud.Color> color.Returns: new giscloud.Marker()

Methods

  • content(<String> content)Gets or sets the content of the marker. Content is shown in the popup, together with the title. If the content argument is provided, the Marker object is returned; if omitted, the method returns the current marker content.Returns: set:this, get:String
  • icon(<Object> iconDefinition)Gets or sets the marker icon. Input is Object or string, an icon definition object or the url if the icon image. If the iconDefinition argument is provided, the Marker object is returned; if omitted, the method returns the marker's icon.Returns: set:this, get:IconDefinition
  • label(<String> label)Gets or sets the label of the marker.Returns: set:this, get:
  • location(<giscloud.LonLat> lonlat)Gets or sets the location of the marker. Called without arguments, returns the current location of the marker. If the lonlat argument is provided, the Marker object is returned; if omitted, the method returns the marker's current location as a giscloud.LonLat object.Returns: set:this, get:giscloud.LonLat
  • popup(<Boolean> onoff)Shows or hides the marker popup. Called without arguments, returns the current visibility of the popup. If the onoff argument is provided, the Marker object is returned; if omitted, the method returns the current popup visibility (bool).Returns: set:this, get:Boolean
  • rotation(<Number> rotation)Gets or sets the rotation of the marker.Returns: set:this, get:
  • title(<String> title)Gets or sets the marker title. The title is shown as a tip when hovering the marker. If the title argument is provided, the Marker object is returned; if omitted, the method returns the current title.Returns: set:this, get:String
  • visible(<Boolean> onoff)Gets or sets the visibility of the flag marker. Called without arguments, returns the current visibility of the marker. If the onoff argument is provided, the Marker object is returned; if omitted, the method returns the marker's visibility as a boolean value.Returns: set:this, get:String

Create new marker

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);

giscloud.Viewer

Defines map viewer and it's also space for showing all layers and markers.

Constructor

  • giscloud.Viewer(<String> containerId, <Number> mapId, <Object> options)Creates a new Viewer.Returns: new giscloud.Viewer()

Methods

  • addLayersExpandParam()
  • addMarker(<giscloud.Marker> marker)Adds a marker to the map viewer.Returns: this
  • areaZoom()Makes active area zoom tool.Returns: this
  • bind(<String> eventName, <Function> handler)Binds an event handler.Returns: this
  • bounds(<giscloud.Bounds> bounds)Gets or sets the bounds of the viewer. If the bounds argument is provided, the Viewer object is returned; if omitted, the method returns the current viewer bounds.Returns: get:giscloud.Bounds, set:this
  • boundsChange(<Function> handler)If bounds are changed call function.Returns: this
  • center(<giscloud.LonLat> center, <Number> zoomLevel)Gets or sets the center of the viewer. If the bounds argument is provided, the Viewer object is returned; if omitted, the method returns the current viewer center as a LonLat object.Returns: get:giscloud.LonLat, set:this
  • container(<String> containerId)Gets or sets map viewer container.Returns: set:this, get:container
  • createAsMaplimProject()
  • doubleClick(<Function> callback)Event handler function for the viewer doubleClick event.Returns: this
  • dragEnd(<Function> handler)Binds a viewer dragEnd event handler.Returns: this
  • editAccept()If in edit mode accepts the changes.Returns: this
  • editCancel()If in edit mode cancels the changes.Returns: this
  • editFeature(<Number> layerId, <Number> featureId, <Object> options)Start editing specified feature in a specified layer.Returns: giscloud.Promise
  • featureClick(<Function> handler)Binds a feature click event handler.Returns: this
  • featureDoubleclick(<Function> handler)Binds a feature click event handler.Returns: this
  • featureOut(<Function> handler)Binds a feature hover our event handler.Returns: this
  • featureOver(<Function> handler)Binds a feature hover event handler.Returns: this
  • filterFeatures(<Number> layerId, <Object> filter)Sets active dynamic feature filtering. Object filter has to be specified with properties 'attributes' which list which attributes should be loaded with map tiles and property 'filter' which is a function that will do the filtering. e.g. {"attributes":"a,b", filter: function(obj) { return obj.a == 123 || obj.b = 456;}Returns: void
  • fullExtent()Zooms to map full extent.Returns: this
  • getRenderParams(<Number> scale)Returns render parameters, image scale factor, image width(px) and height(px).Returns: Object
  • height(<Number> height)Gets or sets the height of the viewer container element. If the height argument is provided, the Viewer object is returned; if omitted, the method returns the height in pixels.Returns: get:Number, set:this
  • hideLayer(<Number> layerId)Hides a layer.Returns: this
  • hideLayerLabels(<Number> layerId)Hides a layer's labels.Returns: this
  • hideTip()Hides the tooltip.Returns: this
  • init(<Function> handler)Binds an event that fires upon viewer initialization.Returns: this
  • layerById(<Number> layerId)Gets a giscloud.ViewerLayer with the specified id.Returns: giscloud.ViewerLayer
  • loadMap(<Number> mapId, <Function> callback, <Boolean> startBounds)Loads a new map into the viewer.Returns: giscloud.Viewer
  • measure()Makes active measure tool.Returns: this
  • mouseDown(<Function> handler)Binds an event that fires upon mouse down event.Returns: this
  • mouseMove(<Function> handler)Binds an event that fires upon mouse move event.Returns: this
  • mouseUp(<Function> handler)Binds an event that fires upon mouse up event.Returns: this
  • openInMaplim()
  • pan()Makes active pan tool.Returns: this
  • ready(<Function> handler)Binds an event that fires upon the map viewer is ready.Returns: this
  • reloadMap()Reloads the map.Returns: this
  • removeLayersExpandParam()
  • removeMarker(<giscloud.Marker> marker)Remove the marker.Returns: this
  • scale(<Number> scale)Gets or sets the viewer scale. If the scale argument is provided, the Viewer object is returned; if omitted, the method returns the current viewer scale.Returns: get:Number, set:this
  • scaleChange(<Function> handler)Binds an event that fires upon the map scale (zoom) has changed.Returns: this
  • select(<Boolean> onoff)Enabled/disables map selection.Returns: this
  • selectFeature(<Number> layerId, <Number>featureId, <Boolean> highlight)Selects a feature and optionally highlights it.Returns: this
  • selectFeaturesByBounds(<Number> layerId, <giscloud.Bounds> bounds, <Boolean> clearOptional)Select features by bounds. Optionally clears already active selection.Returns: this
  • selectionChange(<Function> handler)Binds an event that fires upon selection has changed.Returns: this
  • showLayer(<Number> layerId)Shows a layer.Returns: this
  • showLayerLabels(<Number> layerId)Shows layer's labels.Returns: this
  • showTip(<String> text)Shows the tooltip.Returns: this
  • unbind(<String> eventName, <Function> handler)Unbinds an event handler.Returns: this
  • width(<Number> width)Gets or sets the width of the viewer container element. If the width argument is provided, the Viewer object is returned; if omitted, the method returns the width in pixels.Returns: get:Number, set:this
  • zoomToCurrentLocation()Function zooms on map to your current location using browsers geolocation.Returns: this
  • zoomToLayer(<Number> layerId)Zooms to a layer's extent.Returns: this

Events

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.

Properties

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.

Create new viewer in 'map' container

var viewer = new giscloud.Viewer("map", "mapId");

Bind event handler on viewer

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

Bind event handler on viewer and show coordinates of mouse as tooltip

// ...
viewer.bind("mouseMove", showCoords);

function showCoords(coord) {
    viewer.showTip(coord);
}

giscloud.ViewerLayer

Constructor

  • giscloud.ViewerLayer(<Object> object)Creates viewer layer.Returns: new giscloud.ViewerLayer()

Methods

  • expressionVisible(<Number> index, <Boolean> onoff)Changes expression visibility.Returns: this
  • expressions(<Object> filter)Filter expressions and return giscloud.ViewerLayerExpression.Returns: giscloud.ViewerLayerExpression
  • opacity(<Number> opacity)Gets or sets the layer's opacity.Returns: set:this, get:Boolean
  • redraw()
  • selectable(<Boolean> onoff)Gets or sets the layer's selectable state.Returns: set:this, get:Boolean
  • visible(<Boolean> onoff)Gets or sets the layer's visibility.Returns: set:this, get:Boolean

Properties

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.

giscloud.ViewerSelection

Constructor

  • giscloud.ViewerSelection(<giscloud.Viewer> viewer)Represents a selection of features on the viewer map.Returns: new giscloud.ViewerSelection()

Methods

  • add(<Number> featureId, <Number> layerId)Adds a feature to the selection.Returns: this
  • bind(<String> eventName, <Function> handler)Binds an event handler.Returns: this
  • clear()Clears selection.
  • clearHighlight()Clear highlight features on a map.Returns: this
  • count()Gets the count of selected features.Returns: Number
  • featureAdd(<Function> callback)Binds callback as featureAdd event handler.Returns: this
  • featureRemove(<Function> callback)Binds callback as featureRemove event handler.Returns: this
  • highlightSelected()Highlight seleced features on a map.Returns: this
  • isSelected(<Number> featureId, <Number> layerId)Determines if the feature is in this selection.Returns: Boolean
  • remove(<Number> featureId, <Number> layerId)Remove a feature from the selection.Returns: this
  • selected()Gets all selected features' feature ids and layer ids.Returns: Array of { featureId, layerId }
  • selectionClear(<Function> callback)Binds callback as selectionClear event handler-Returns: this
  • toggle(<Number> featureId, <Number> layerId)Toggles feature selection.Returns: this
  • unbind(<String> eventName, <Function> handler)Unbinds an event handler.Returns: this

Events

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.

Properties

Property Type Description
ctrlDown Boolean Pretends to have the ctrl button down when clicking on features to select. Default is false.

giscloud.ViewerLayerExpression

Constructor

  • giscloud.ViewerLayerExpression(<ViewerLayer> viewer layer, <Object> object)Creates expression viewer layer.Returns: new giscloud.ViewerLayerExpression()

Methods

  • expressionVisible(<Number> index, <Boolean> onoff)Changes expression visibility.Returns: this
  • expressions(<Object> filter)Filter expressions and return giscloud.ViewerLayerExpression.Returns: giscloud.ViewerLayerExpression
  • opacity(<Number> opacity)Gets or sets the layer's opacity.Returns: set:this, get:Boolean
  • redraw()Method redraws expressions.
  • selectable(<Boolean> onoff)Gets or sets the layer's selectable state.Returns: set:this, get:Boolean
  • visible(<Boolean> onoff)Gets or sets the layer's visibility.Returns: set:this, get:Boolean

Properties

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.

giscloud.datasources

Methods

  • giscloud.datasources.addColumn(<String> id_or_rel_path, <Object> data)Adds a new column to a datasource.Returns: giscloud.Promise
  • giscloud.datasources.byId(<Number> id, <Object> options, <Function> callback)Returns a datasource.Returns: giscloud.Promise
  • giscloud.datasources.columns(<String> id_or_rel_path, <Object> options, <Function> callback)Returns datasource column list.Returns: giscloud.Promise
  • giscloud.datasources.create(<Object> data)Creates a new datasource.Returns: giscloud.Promise
  • giscloud.datasources.dropColumn(<String> id_or_rel_path)Drops a column.Returns: giscloud.Promise
  • giscloud.datasources.list()List available datasources.Returns: giscloud.Promise
  • giscloud.datasources.remove(<Number> datasourceId)Deletes a datasource.Returns: giscloud.Promise
  • giscloud.datasources.typeCodeToTypeName()
  • giscloud.datasources.typeNameToTypeCode()
  • giscloud.datasources.update(<Number> datasourceId)Updates a datasource.Returns: giscloud.Promise
  • giscloud.datasources.updateColumn(<String> id_or_rel_path, <Object> data)Updates datasource column.Returns: giscloud.Promise

Properties

Property Type Description
giscloud.datasources.sfdc
giscloud.datasources.types
giscloud.datasources.wmts

List all data sources for one user

giscloud.datasources.list()
    .done(function(data) {
        console.log(data.total); //number of data sources
    });

Create new data source

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);
    });

Create new data source -> from wms

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

Methods

  • giscloud.datasources.wms.getCapabilities(<String> wmsURL, <String> wmsVersion)Returns getCapabilities response from a wmsURL WMS server.Returns: String XML
  • giscloud.datasources.wms.getFeatureInfo(<Number> layerId, parameters)Returns informations about feature.Returns:
giscloud.datasources.wms
    .getCapabilities("https://editor.giscloud.com/wms/346c5724511c16b7faffa35cfce2f7b6", "1.3.0")
    .done(function(data) {
        console.log(data.srs);
    });

giscloud.datasources.Datasource

Constructor

  • giscloud.datasources.Datasource(<Object> data)Creates a new giscloud.datasources.Datasource object. Data properties can be id, resource_id, name, owner_id, type, epsg, proj4, description and copyright.Returns: new giscloud.datasources.Datasource()

Methods

  • clone()Creates a new giscloud.Datasource object with the same values as the original.Returns: A new giscloud.Datasource object.
  • remove()Deletes this datasource from the Cloud.Returns: giscloud.Promise
  • share(<String> userName, <String> permission)Shares datasource to a user with certain permissions.Returns: giscloud.Promise
  • update(<Object> data)Updates datasource.Returns: giscloud.Promise

Properties

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.

giscloud.geometry

Methods

  • giscloud.geometry.fromGeoJSON(<Object> geojson)Converts GeoJSON format into a giscloud.geometry e.g. giscloud.geometry.PointReturns: giscloud.geometry.Geometry (Point, Line, Polygon, ...)
  • giscloud.geometry.fromOGC(<String> WKT)Converts WKT format into a giscloud.geometry e.g. giscloud.geometry.PointReturns: giscloud.geometry.Geometry (Point, Line, Polygon, ...)
  • giscloud.geometry.hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • giscloud.geometry.toOGC()Gets a GeometryCollection geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT
var point = new giscloud.geometry.Point(-6140.0432, 6709200.4413); //giscloud point object
giscloud.geometry.toOGC(point);

giscloud.geoutils

Methods

  • giscloud.geoutils.area(<giscloud.GraphicFeature> graphicFeature, <String> geometrySrid, <String> outputSrid, <Function> callback)Returns area in string format.Returns: giscloud.Promise
  • giscloud.geoutils.featureArea(<Number> layerId, <Number> featureId, <String> geometrySrid, <String> outputSrid, <Function> callback)Returns feature area in string format.Returns: giscloud.Promise
  • giscloud.geoutils.featureBounds()
  • giscloud.geoutils.featuresAtPoint(<giscloud.LonLat> position, <Number> layerIds, <Object> options, <Function> callback)Finds features across given layers that intersect with a given point.Returns: giscloud.Promise
  • giscloud.geoutils.featuresAtPointForMap(<giscloud.LonLat> position, <Number> mapId, <Object> options)Finds features in a given map that intersect with a given point.Returns: giscloud.Promise
  • giscloud.geoutils.merge()
  • giscloud.geoutils.nearest()
  • giscloud.geoutils.spatialFilter(<giscloud.geometry.*> filterGeometry, <Number> layerIds, <Object> options, <Function> callback)Filter for spatial data. Define geometry for filtering with 'filterGeometry'.Returns: giscloud.Promise
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
});

Filter features from layers using custom polygon geometry from WKT

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);
    });

giscloud.spatialrelationship

Methods

  • giscloud.spatialrelationship.intersects(<Number> layer1Id, <Number> feature1Id, <Number> layer2Id, <Number> feature2Id, options)Checks if features intersect.Returns: giscloud.Promise
  • giscloud.spatialrelationship.within(<Number> layer1Id, <Number> feature1Id, <Number> layer2Id, <Number> feature2Id, options)Checks if feature1 from layer1 is within feature2 from layer2.Returns: giscloud.Promise

Check if one feature is within another

//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
    });

giscloud.geometry.GeometryCollection

Constructor

  • giscloud.geometry.GeometryCollection(<giscloud.geometry.*> geometries)Creates a new geometry collection.Returns: new giscloud.geometry.GeometryCollection()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a GeometryCollection geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
geometries Object giscloud.geometry.* objects contained in this GeometryCollection.

giscloud.geometry.Line

Constructor

  • giscloud.geometry.Line(<Array of <giscloud.geometry.Point>> points)Creates a new line.Returns: new giscloud.geometryLine()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a Line geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
points Object Array of giscloud.geometry.Point contained in this Line.

Create giscloud line object

var line = new giscloud.geometry.Line(listOfPoints);

giscloud.geometry.Multiline

Constructor

  • giscloud.geometry.Multiline(<Array of <giscloud.geometry.Line>> lines)Creates a new multiline.Returns: new giscloud.geometry.Multiline()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a Multiline geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
lines Object Array of giscloud.geometry.Line contained in this Multiline.

Create giscloud multiline object

var multiline = new giscloud.geometry.Multiline(listOfLines);

giscloud.geometry.Multipoint

Constructor

  • giscloud.geometry.Multipoint(<Array of <giscloud.geometry.Point>> points)Creates a new multipoint.Returns: new giscloud.geometry.Multipoint()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a Multipoint geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
points Object Array of giscloud.geometry.Point contained in this Multipoint.

Create giscloud multipoint object

var multipoint = new giscloud.geometry.Multipoint(listOfPoints);

giscloud.geometry.Multipolygon

Constructor

  • giscloud.geometry.Multipolygon(<Array of <giscloud.geometry.Polygon>> polygons)Creates a new multipolygon.Returns: new giscloud.geometry.Multipolygon()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a Multipolygon geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
polygons Object Array of giscloud.geometry.Polygon contained in this Multipolygon.

Create giscloud multipolygon object

var multipolygon = new giscloud.geometry.Multipolygon(listOfPolygons);

giscloud.geometry.Point

Constructor

  • giscloud.geometry.Point(<Number> x, <Number> y, <Number> z)Creates a new point.Returns: new giscloud.geometry.Point()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a Point geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
x Object X value.
y Number Y value.

Create giscloud point object

var point = new giscloud.geometry.Point(lon, lat, z);

giscloud.geometry.Polygon

Constructor

  • giscloud.geometry.Polygon(<Array of <giscloud.geometry.Line>> rings)Creates a new polygon.Returns: new giscloud.geometry.Polygon()

Methods

  • bounds()Returns giscloud.Bounds object.Returns: giscloud.Bounds
  • hasZ()Checks if geometry has Z coordinate.Returns: Boolean
  • toOGC()Gets a Polygon geometry object string in OGC Simple Features WKT (well-known text).Returns: WKT

Properties

Property Type Description
rings Object Array of giscloud.geometry.Line contained in this Polygon.

Create giscloud polygon object

var polygon = new giscloud.geometry.Polygon(rings);

giscloud.Query

Constructor

  • giscloud.Query(<giscloud.tables> table, <Object> options)Creates a new query for existing table.Returns: new giscloud.Query()

Methods

  • always()Always method.Returns: giscloud.Promise
  • andWhere(<String> | <Number> attribute, <String> operator, <String> | <Number> value)Creates a new 'AND WHERE' condition for the query.Returns: this
  • andWhereClose()Closes an open 'AND WHERE (...)' grouping.Returns: this
  • andWhereOpen()Opens a new 'AND WHERE (...)' grouping.Returns: this
  • ascending(<String> key)Sorts the results in ascending order by the given key.Returns: this
  • count()Counts the number of objects that match this query.Returns: this
  • delete()Deletes a single record while ignoring relationships.Returns: this
  • descending(<String> key)Sorts the results in descending order by the given key.Returns: this
  • done(<Function> callback)Registering callback to be executed upon successful query.Returns: this
  • each(<Function> callback)Registering callback to be executed upon each row in the result.Returns: this
  • equalTo(<String> key, <String> | <Number> value)Add a constraint to the query that requires a particular key's value to be equal to the provided value.Returns: this
  • fail()Fail method.Returns: giscloud.Promise
  • find()Retrieves a list of Objects that satisfy this query.Returns: Objects
  • first()Retrieves at most one Object that satisfies this query.Returns: Object
  • greaterThan(<String> key, <Number> value)Add a constraint to the query that requires a particular key's value to be greater than the provided value.Returns: this
  • greaterThanOrEqualTo(<String> key, <Number> value)Add a constraint to the query that requires a particular key's value to be greater than or equal to the provided value.Returns: this
  • groupBy(<String> | <Number> column)Creates a 'GROUP BY ...' filter.Returns: this
  • join(<String> | <Number> table, <String> type)Adds addition tables to 'JOIN ...'.Returns: this
  • lessThan(<String> key, <Number> value)Add a constraint to the query that requires a particular key's value to be less than the provided value.Returns: this
  • lessThanOrEqualTo(<String> key, <Number> value)Add a constraint to the query that requires a particular key's value to be less than or equal to the provided value.Returns: this
  • limit(<Number> number)Sets the limit of the number of results to return.Returns: this
  • notEqualTo(<String> key, <String> | <Number> value)Add a constraint to the query that requires a particular key's value to be not equal to the provided value.Returns: this
  • offset(<Number> number)Sets the number of results to skip before returning any results.Returns: this
  • on(<String> | <Number> attribute, <String> operator, <String> | <Number> value)Adds 'ON ...' conditions for the last created JOIN statement.Returns: this
  • orWhere(<String> | <Number> attribute, <String> operator, <String> | <Number> value)Creates a new 'OR WHERE' condition for the query.Returns: this
  • orWhereClose()Closes an open 'OR WHERE (...)' grouping.Returns: this
  • orWhereOpen()Opens a new 'OR WHERE (...)' grouping.Returns: this
  • progress()Progress method.Returns: giscloud.Promise
  • save()Updates or Creates the record depending on loaded().Returns: this
  • saveAll()Updates or Creates the record.Returns: this
  • select(<String> | <Number> column)Choose the columns to select from.Returns: this
  • selectFunction(<String> methodName, <Object> args)Choose the function.Returns: this
  • set(<String> | <Number> column, <String> | <Number> value)Base set method - this should not be overridden.Returns: this
  • then()Then method.Returns: giscloud.Promise
  • toString()Returns query as string.Returns: string
  • where(<String> field, operator, <String> | <Number> value)Retrieves a list of Objects that satisfy this query.Returns: Objects
  • whereClose()Closes an open 'AND WHERE (...)' grouping.Returns: this
  • whereOpen()Opens a new 'AND WHERE (...)' grouping.Returns: this

Properties

Property Type Description
options Object Options parameter in query object.

Create new query for 'myTable' table

new giscloud.Query("myTable")
    .where("ogc_fid", ">", 3)
    .first()
    .done(function(record) {
        console.log(record);
    });

giscloud.Color

Constructor

  • giscloud.Color(<Number> red, <Number> green, <Number> blue, <Number> alpha)Creates a new color using RGB and alpha values.Returns: new giscloud.Color(red, green, blue, alpha)

Methods

  • alpha(<Number> value)Gets or sets the color's alpha value.Returns: get:Number, set:this
  • brighter(<Number> value)Creates a color brighter than the original. Effectively, the new color has lightness increased by val.Returns: giscloud.Color
  • clone()Creates a new Color object with the same color values as the original.Returns: A new Color object.
  • darker(<Number> value)Creates a color darker than the original. Effectively, the new color has lightness decreased by val.Returns: giscloud.Color
  • equals()Checks if the color is equal in value as another Color object.Returns: Boolean
  • hex()Gets the color's hex string.Returns: get:String
  • hsl(<Number> hue, <Number> saturation, <Number> lightness)Gets or sets the color's HSL values. Input params are integers, color component levels in HSL space. The value range for should be 0-360 for hue and 0-100 for saturation and lightness values.Returns: get:undefined, set:this
  • hsv(<Number> hue, <Number> saturation, <Number> value)Gets or sets the color's HSV values. Input params are integers, color component levels in HSV space. The value range for should be 0-360 for hue and 0-100 for saturation and value values.Returns: get:undefined, set:this
  • rgb(<Number> red, <Number> green, <Number> blue)Gets or sets the color's RGB values. Input params are integers, color component levels in RGB space. Values should range from 0 to 255.Returns: get:undefined, set:this
  • rgba()Returns list of rgba components.Returns: Array
  • toRgbString()Returns rgb string.Returns: String
  • toRgbaString()Returns rgba string.Returns: String

Create new color object

var c = new giscloud.Color(255, 0, 0);

c.hex() // "#FF0000"
c.hex("0x") // "0xFF0000"
c.hex("HEX:") // "HEX:FF0000"
c.hex("") // "FF0000"

giscloud.Bounds

Geographical bounds, an extent.

Constructor

  • giscloud.Bounds(<Number> left, <Number> bottom, <Number> right, <Number> top)Creates a new Bounds object.Returns: new giscloud.Bounds(left, bottom, right, top)

Methods

  • center(<giscloud.LonLat>)Center of the bounds.Returns: get:giscloud.LonLat, set:giscloud.LonLat
  • clone()Creates a new giscloud.Bounds object with the same values as the original.Returns: A new giscloud.Bounds object.
  • height()Height of the bounds.Returns: Number
  • include(<giscloud.LonLat> lonlat | <giscloud.Bounds> bounds, bufferOptional)Includes a LonLat or Bounds into existing bounds, potentially expanding its extent.Returns: giscloud.LonLat or giscloud.Bounds
  • isPoint()Checks if Bounds is pointReturns: Boolean
  • toArray()Gets an array representation of the Bounds object.Returns: Array undefined
  • toString()Gets a string representation of the Bounds object.Returns: String
  • valid()Checks if bounds is valid.Returns: Boolean
  • width()Width of the bounds.Returns: number

Properties

Property Type Description
bottom Number Bottom boundary.
left Number Left boundary.
right Number Right boundary.
top Number Top boundary.

Create new bounds object

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

giscloud.Geometry

This object is prototype for giscloud.geometry.*.

Constructor

  • giscloud.Geometry()Default constructorReturns: new giscloud.Geometry()

Methods

giscloud.date

Methods

  • giscloud.date.daysInMonth(<Number> month, <Number> year)Constructs Date object from month yearReturns: Date
  • giscloud.date.generateTimeline(<Array> years, <Boolean> showDays, <Number> step, <Boolean> dontGoInFuture)Generate Timeline array.Returns: Array
  • giscloud.date.getTimelineDateIndex(<Array> timeLineArray, <Number> timestamp)Returns index of a timestamp in the timeline.Returns: Number
var numberOfDays = giscloud.date.daysInMonth(7, 2014);
parseInt(numberOfDays); //return number of days in July, 2014 year

giscloud.formats

Properties

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.

giscloud.formats.exportFormats

Properties

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.

giscloud.formats.renderFormats

Properties

Property Type Description
giscloud.formats.renderFormats.IFRAME Iframe HTML output.
giscloud.formats.renderFormats.JPEG JPEG image format.
giscloud.formats.renderFormats.PNG PNG image format.

giscloud.layers.attributeOps

Methods

  • giscloud.layers.attributeOps.distinct(<Number> layerId, <String> attribute, <Object> options)Performs a distinct or ranges query on an attribute from a given layer.Returns: giscloud.Promise
  • giscloud.layers.attributeOps.info()
var options = {
    perpage: 5,
    page: 1
};
giscloud.layers.attributeOps.distinct(733107, "attribute1", options)
    .done(function(data) {
        console.log(data.data); //list of attribute values
    });

giscloud.LonLat

Simple point with only position properties.

Constructor

  • giscloud.LonLat(<Number> longitude, <Number> latitude)Creates a new location object.Returns: new giscloud.LonLat()

Methods

  • clone()Creates a new giscloud.LonLat object with the same values as the original.Returns: A new giscloud.LonLat object.
  • equals(<giscloud.LonLat> other)Compares two LonLat objects.Returns: Boolean
  • toArray()Gets an array representation of the LonLat object.Returns: undefined
  • toBounds(<Number> bufferOptional)Returns giscloud.Bounds object made from LonLat with an optional buffer.Returns: giscloud.Bounds
  • toString()Gets a string representation of the LonLat object.Returns: String("lon lat")
  • transform(<Number> EPSG of giscloud.LonLat, <Number> new EPSG of giscloud.LonLat)Transform giscloud.LonLat point from one projection to another.Returns: giscloud.LonLat
  • valid()Is a LonLat object valid?Returns: Boolean

Properties

Property Type Description
lat Number Latitude
lon Number Longitude

Create new LonLat object and print object properties (lon and lat)

var lonlat = new giscloud.LonLat(3, 5);

lonlat.lon.toString(); //return longitude -> "3"
lonlat.lat.toString(); //return latitude -> "5"

Create two LonLat objects and check if coordinates of objects are equal

var lonlat_first = new giscloud.LonLat(3, 5);
var lonlat_second = new giscloud.LonLat(5, 3);

lonlat_first.equals(lonlat_second); //return false

Transform LonLat object from one projection to another

var lonlat = new giscloud.LonLat(11, 17);
lonlat.transform(4326, 900913);

giscloud.proxy

Methods

  • giscloud.proxy.call(<String> URL, <Object> options, <Function> callback)Makes a call on URL on behalf of GIS Cloud.Returns: giscloud.Promise

Call "www.giscloud.com" and print http status

function httpStatus(response) {
    console.log(response.http_status); //print http status
}
giscloud.proxy.call("www.giscloud.com", httpStatus);

giscloud.DependencyResolver

Constructor

  • giscloud.DependencyResolver()Default constructorReturns: new giscloud.DependencyResolver()

Methods

  • addItem()
  • check()
  • itemByUuid()
  • resolveDependency()

Properties

Property Type Description
formHasDependencies Boolean
formHasEnvDependencies Boolean
formHasItemDependencies Boolean
itemIndex Object
items Object
triggArray Object

giscloud.Promise

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/).

Constructor

  • giscloud.Promise()Default constructorReturns: new giscloud.Promise()

Methods

  • always(<Function> callbacks, <Function> callbacksOptional)Add handlers to be called when the Deferred object is either resolved or rejected.Returns: Deferred
  • done(<Function> callbacks, <Function> callbacksOptional)Add handlers to be called when the Deferred object is resolved.Returns: Deferred
  • fail(<Function> callbacks, <Function> callbacksOptional)Add handlers to be called when the Deferred object is rejected.Returns: Deferred
  • pipe(<Function> doneFilter, <Function> failFilterOptional)Utility method to filter and/or chain Deferreds.Returns: Promise
  • progress(<Function> progressCallbacks)Add handlers to be called when the Deferred object generates progress notifications.Returns: Deferred
  • promise(<Object> target)Return a Deferred's Promise object.Returns: Promise
  • state()Determine the current state of a Deferred object.Returns: String
  • then(<Function> doneFilter,<Function> failFilterOptional ,<Function> progressFilter?)Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.Returns: Promise

giscloud.Queue

Constructor

  • giscloud.Queue()Default constructorReturns: new giscloud.Queue()

Methods

  • abort()
  • always(<Function> callbacks, <Function> callbacksOptional)Add handlers to be called when the Deferred object is either resolved or rejected.Returns: Deferred
  • done(<Function> callbacks, <Function> callbacksOptional)Add handlers to be called when the Deferred object is resolved.Returns: Deferred
  • fail(<Function> callbacks, <Function> callbacksOptional)Add handlers to be called when the Deferred object is rejected.Returns: Deferred
  • pipe(<Function> doneFilter, <Function> failFilterOptional)Utility method to filter and/or chain Deferreds.Returns: Promise
  • progress(<Function> progressCallbacks)Add handlers to be called when the Deferred object generates progress notifications.Returns: Deferred
  • promise(<Object> target)Return a Deferred's Promise object.Returns: Promise
  • promises()Returns Array of all promises.Returns: Array of Promise
  • results()Returns Array of all results.Returns: Array of results
  • state()Determine the current state of a Deferred object.Returns: String
  • then(<Function> doneFilter, <Function> failFilterOptional, <Function> progressFilter?)Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.Returns: Promise

giscloud.Relay

Constructor

  • giscloud.Relay()Default constructorReturns: new giscloud.Relay()

Methods

  • abort()
  • always()
  • done()
  • fail()
  • pipe()
  • progress()
  • promise()
  • promises()
  • results()
  • state()
  • then()

giscloud.Role

Constructor

  • giscloud.Role()Default constructorReturns: new giscloud.Role()

Methods

  • remove()
  • update()

Properties

Property Type Description
app_instance_id Object
app_role Boolean
id
name
owner_id Object
parent_id Object

giscloud.keys

Methods

  • giscloud.keys.add(<String> descriptions)Creates a new API key with a given description.Returns: giscloud.Promise
  • giscloud.keys.byId()
  • giscloud.keys.list()
  • giscloud.keys.remove(<Number> id)Deletes an API key.Returns: giscloud.Promise

Create new API key

giscloud.keys.add("write_some_description");

giscloud.oauth2

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.

Methods

  • giscloud.oauth2.authorize(<String> clientId, <Function> callback)Starts the authorization procedure. Calls the callback method once done.Returns: this
  • giscloud.oauth2.button(<String> containerIdOptional)Places the Sign in button inside the specified container.Returns: set:this, get:
  • giscloud.oauth2.frameId()Returns ID of a frame used for the auth process.Returns: String
  • giscloud.oauth2.setToken(<String> token)Sets token.Returns: void
  • giscloud.oauth2.signIn(<Object> options)Starts the sign-process. Opens a window for entering authorize credentials. Options: <Function> onSuccess, <Function> onCancel.Returns: void
  • giscloud.oauth2.signOut(<Function> callback)Sign out the user.Returns: giscloud.Promise
  • giscloud.oauth2.thisIsOauthFrame()Checks if API is in auth frame or not.Returns: Boolean
  • giscloud.oauth2.token()Retrieves the token if one has been obtained.Returns: String

Create login button in 'login' container

// 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");
});

giscloud.permissions

Properties

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.

giscloud.ui

Methods

  • giscloud.ui.checkLogin()Checks if a user is logged in. If not it displays a proper message.Returns: Boolean
  • giscloud.ui.confirm(<String> html, <Object> options)Shows a confirm dialog. In options it's possible to specify callback_yes and callback_no properties as functions that will be called upon dialog result.Returns: this
  • giscloud.ui.filters(<Object> filters, <DOM> target, <Object> options)Creates filter object.Returns: this
  • giscloud.ui.fullScreen(<Object> options)Opens form manager in full screen.Returns: this
  • giscloud.ui.greenAlert(<String> msg, <Number> duration)Creates green alert.Returns: this
  • giscloud.ui.id()Generates new id.Returns: String
  • giscloud.ui.inlineEdit(<DOM> selector, <Object> options)Initializes inline editing on DOM element.Returns: this
  • giscloud.ui.legend()
  • giscloud.ui.modal(<Object> options)Creates modal window.Returns: this
  • giscloud.ui.newWindow()Opens new window.Returns: giscloud.Promise
  • giscloud.ui.openMap(<Number> mapId)Loads a specified map.
  • giscloud.ui.popup(<Object> options)Opens popup window.Returns: this
  • giscloud.ui.prompt(<String> message, <String> value, <String> title, <String> placeholder, <DOM> container)Prompts for a value.Returns: giscloud.Promise
  • giscloud.ui.redAlert(<String> msg, <Number> duration)Creates red alert.Returns: this
  • giscloud.ui.streetView()Creates street view tool.

Properties

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

Check if user is logged in

giscloud.ui.checkLogin(); //return true or false

Create green alert

giscloud.ui.greenAlert("I'm green alert!", 1000);

giscloud.ui.defaultTools

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 method yourself. This way a tool can be placed anywhere on the page instead the toolbar strip.) - viewer (If you set the viewer through options, the tool can act independatly without being added to a toolbar. If the tool is, however, added to a toolbar, the toolbars viewer takes precedence over this setting.

Methods

  • giscloud.ui.defaultTools.areaMeasure()Returns area measure tool.
  • giscloud.ui.defaultTools.areaSelect(<Object> options)Returns area select tool.
  • giscloud.ui.defaultTools.azimuth()Returns azimuth tool.
  • giscloud.ui.defaultTools.countByPolygon()Returns count by polygon tool.
  • giscloud.ui.defaultTools.freehand()
  • giscloud.ui.defaultTools.full(<Object> options)Returns full zoom extent tool.
  • giscloud.ui.defaultTools.info(<Object> options)Returns identify tool.
  • giscloud.ui.defaultTools.measure(<Object> options)Returns measure tool.
  • giscloud.ui.defaultTools.pan(<Object> options)Returns pan tool.
  • giscloud.ui.defaultTools.pickCoordinates(<Object> options)Returns coordinates picker tool.
  • giscloud.ui.defaultTools.select(<Object> options)Returns select tool.
  • giscloud.ui.defaultTools.selectExtent(<Object> options)Returns select by area selection tool.
  • giscloud.ui.defaultTools.tool(<String> toolName, <Object> options)Returns tool by name.
  • giscloud.ui.defaultTools.zoom(<Object> options)Returns zoom tool.

giscloud.ui.FeatureDatagrid

Constructor

  • giscloud.ui.FeatureDatagrid(<HTML element> element, <Object> options)Creates a new FeatureDatagrid.Returns: new giscloud.ui.FeatureDatagrid()

Methods

  • clear()
  • data()
  • destroy()
  • reset()
  • save()

Events

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.

Properties

Property Type Description
loaded Object

Create new FeatureDatagrid

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 >
        }
    });

giscloud.ui.FeatureForm

Constructor

  • giscloud.ui.FeatureForm()Default constructorReturns: new giscloud.ui.FeatureForm()

Methods

  • clear()
  • data()
  • destroy()
  • reset()
  • save()

Properties

Property Type Description
loaded Object

giscloud.ui.Toolbar

Constructor

  • giscloud.ui.Toolbar(<Object> options)Creates a new toolbar.Returns: new giscloud.ui.Toolbar()

Methods

  • add(<Tools> ...)Adds <Tools> to the toolbar. If the container is set for the toolbar, these will be automatically rendered.Returns: this
  • bind(<String> eventName, <Function> handler)Binds an event handler.Returns: this
  • remove(<String> toolName)Removes a tool.Returns: this
  • toolChange(<Function> handler)Binds to an even that fires when tool changesReturns: this
  • unbind(<String> eventName, <Function> handler)Unbinds an event handler.Returns: this

Events

Event Data Description
toolChange Event Fired when the tool selection is changed.

Properties

Property Type Description
tools Object Contains all tools in the toolbar.
viewer Reference to a Viewer that is connected with this toolbar.

Create viewer in 'map' container and toolbar in 'toolbar' container

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
});

Create your own tool and add it in toolbar

//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);
}