giscloudtop

Methods

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

giscloud.Boundstop

Geographical bounds, an extent.

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

Constructor

Constructor Usage Description
giscloud.Bounds( <Number> left, <Number> bottom, <Number> right, <Number> top ) new giscloud.Bounds(left, bottom, right, top) Creates a new Bounds object.

Methods

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

Properties

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

giscloud.Colortop

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

Constructor

Constructor Usage Description
giscloud.Color( <Number> red, <Number> green, <Number> blue, <Number> alpha ) new giscloud.Color(red, green, blue, alpha) Creates a new color using RGB and alpha values.

Methods

Method Returns Description
alpha( <Number> value ) get:Number, set:this Gets or sets the color’s alpha value.
brighter( <Number> value ) giscloud.Color Creates a color brighter than the original. Effectively, the new color has lightness increased by val.
clone() A new Color object. Creates a new Color object with the same color values as the original.
darker( <Number> value ) giscloud.Color Creates a color darker than the original. Effectively, the new color has lightness decreased by val.
equals() Boolean Checks if the color is equal in value as another Color object.
hex() get:String Gets the color’s hex string.
hsl( <Number> hue, <Number> saturation, <Number> lightness ) get:[hue, saturation, lightness], set:this 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.
hsv( <Number> hue, <Number> saturation, <Number> value ) get:[hue, saturation, value], set:this 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.
rgb( <Number> red, <Number> green, <Number> blue ) get:[hue, saturation, lightness], set:this 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.
rgba() Array Returns list of rgba components.
toRgbString() String Returns rgb string.
toRgbaString() String Returns rgba string.

giscloud.Featuretop

Object that can have a geometry properties.

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

See live demo on links below

Constructor

Constructor Usage Description
giscloud.Feature( featureData ) new giscloud.Feature({...}) 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.

Methods

Method Returns Description
clone() giscloud.Feature 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.
remove() giscloud.Promise Removes this feature.
update( <Object> options ) giscloud.Promise Updates changes made to this feature.

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.

giscloud.FlagMarkertop

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

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

See live demo on links below

Constructor

Constructor Usage Description
giscloud.FlagMarker( <giscloud.LonLat> position, <String> title, <String> content, <giscloud.Color> color ) new giscloud.FlagMarker() Makes a new Flag marker.

Methods

Method Returns Description
color( <giscloud.Color> color? ) set:this, get:String 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.
content( <String> content ) set:this, get:String 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.
position( <giscloud.LonLat> pos? ) set:this, get:String 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.
title( <String> title ) set:this, get:String 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.
visible( <Boolean> onoff ) set:this, get:Boolean Gets or sets the visibility of the flag marker.

giscloud.Geometrytop

This object is prototype for giscloud.geometry.*.

Constructor

Constructor Usage Description
giscloud.Geometry() new giscloud.Geometry() Default constructor

Methods

Method Returns Description
bounds( <Number> buffer ) giscloud.Bounds Method returns bounds object using buffer parameter.
hasZ( <giscloud.geometry.Point> | <giscloud.geometry.Multipoint> | <giscloud.geometry.Line> | <giscloud.geometry.Multiline> | <giscloud.geometry.Polygon> | <giscloud.geometry.Multipolygon> | <giscloud.geometry.GeometryCollection> ) Boolean Checks if feature has Z value.
toOGC( <giscloud.geometry.Point> | <giscloud.geometry.Multipoint> | <giscloud.geometry.Line> | <giscloud.geometry.Multiline> | <giscloud.geometry.Polygon> | <giscloud.geometry.Multipolygon> | <giscloud.geometry.GeometryCollection> ) WKT Method returns feature geometry in the form of Well-known text.

giscloud.Graphictop

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

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

Constructor

Constructor Usage Description
giscloud.Graphic() new giscloud.Graphic() Default constructor

Methods

Method Returns Description
acceptDraw() this Checks if drawing mode is on.
add( <giscloud.GraphicFeature> feature ) this Adds a graphic feature to the layer.
bind( <String> eventName, <Function> handler ) this Binds an event handler.
cancelDraw() this Cancels drawing mode.
clear() this Clears the layer.
draw( <String> type, <Function> drawEndCallback, <Function> drawCancelCallback ) giscloud.Promise 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).
edit( <giscloud.GraphicFeature> graphicFeature ) giscloud.Promise Starts editing a graphic feature.
editAccept() this Accepts the changes.
editCancel() this Cancels the change.
exists( <giscloud.graphicFeature> graphicFeature ) <Number> Returns index of graphic feature.
isFeatureCountOkForSnapping() Boolean Checks if number of features is less then 10000.
measureDisplay( <Boolean> onoff ) this Choose if you want to display measures.
remove( <giscloud.GraphicFeature> feature ) this Removes graphic feature from the layer.
setId( <giscloud.GraphicFeature> graphicFeature, <Number> newId ) Method changes graphic feature id.
snapToLayersGeometry( <true/false> options ) this Method starts snapping mode.
unbind( <String> eventName, <Function> handler ) this Unbinds an event handler.

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.

giscloud.GraphicFeaturetop

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

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

Constructor

Constructor Usage Description
giscloud.GraphicFeature( <giscloud.geometry.Point> | <giscloud.geometry.Multipoint> | <giscloud.geometry.Line> | <giscloud.geometry.Multiline> | <giscloud.geometry.Polygon> | <giscloud.geometry.Multipolygon> | <giscloud.geometry.GeometryCollection>, <giscloud.GraphicStyle> ) new giscloud.GraphicFeature() Creates a new GraphicFeature object.

Methods

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

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

giscloud.GraphicStyletop

Style for giscloud.GraphicFeature.

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

Constructor

Constructor Usage Description
giscloud.GraphicStyle( <String> argument | <Object> argument ) new giscloud.GraphicStyle() Defines style for feature display. arguments can be ‘point’, ‘line’ and ‘polygon’. properties contains color, fill and size params.

Methods

Method Returns Description
stringify() String Returns graphic style object in form of 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.

giscloud.LabelMarkertop

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

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

Constructor

Constructor Usage Description
giscloud.LabelMarker( <giscloud.LonLat> location, <Object> options ) new giscloud.LabelMarker() Makes a new Label marker. Options are content and visible.

Methods

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

giscloud.Layertop

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

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

See live demo on links below

Constructor

Constructor Usage Description
giscloud.Layer( <Object> data ) new giscloud.Layer() Creates a new layer.

Methods

Method Returns Description
clone() giscloud.Layer Makes a new layer object which is a clone of the original. Call update on the new layer to save it to the cloud.
copyStylesFrom( <Number> layerId ) giscloud.Layer Copies styles from an existing layer.
remove() giscloud.Promise Removes this layer.
reset() giscloud.Promise Reinitializes this layer (tiles).
update() giscloud.Promise Updates changes made on this layer.

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

giscloud.LonLattop

Simple point with only position properties.

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

Constructor

Constructor Usage Description
giscloud.LonLat( <Number> longitude, <Number> latitude ) new giscloud.LonLat() Creates a new location object.

Methods

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

Properties

Property Type Description
lat Number Latitude
lon Number Longitude

giscloud.Maptop

Creates a map which contains basic informations about project.

            //create Map object

            var mapData = {
                name: "myMap",
                active: true,
                owner: , //user id
                module: "map",
                units: "meter",
                tms_code: "mapquest-osm"
            };
            var map = new giscloud.Map(mapData); //new Map object
            

Constructor

Constructor Usage Description
giscloud.Map() new giscloud.Map() Creates a new giscloud.Map object.

Methods

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

Properties

Property Type Description
accessed Object Access timestamp.
active Boolean Is the map active.
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.
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?

giscloud.Markertop

The most complex marker with many different options.

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

Constructor

Constructor Usage Description
giscloud.Marker( <giscloud.LonLat> location, options ) new giscloud.Marker() Makes a new marker. Options are title, content, visible, icon, label, rotation, popup and color.

Methods

Method Returns Description
content( <String> content ) set:this, get:String 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.
icon( <Object> iconDefinition ) set:this, get: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.
label( <String> label ) set:this, get:<String> Gets or sets the label of the marker.
location( <giscloud.LonLat> lonlat ) set:this, get:giscloud.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.
popup( <Boolean> onoff ) set:this, get:Boolean 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).
rotation( <Number> rotation ) set:this, get:<Number> Gets or sets the rotation of the marker.
title( <String> title ) set:this, get:String 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.
visible( <Boolean> onoff ) set:this, get:String 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.

giscloud.Promisetop

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: http://api.jquery.com/promise/).

Constructor

Constructor Usage Description
giscloud.Promise() new giscloud.Promise() Default constructor

Methods

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

giscloud.Querytop

            // create new query for 'myTable' table
            // possible values for geometry param: false | 'wkt' | 'wkb'

            new giscloud.Query("myTable", {geometry: 'wkt'})
                .where("ogc_fid",">",3)
                .first()
                .done(function(record) {
                    console.log(record);
                });
            
            // create new query for 'myTable' table and print record without geometry

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

See live demo on links below

Constructor

Constructor Usage Description
giscloud.Query( <giscloud.tables> table, <Object> options ) new giscloud.Query() Creates a new query for existing table.

Methods

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

Properties

Property Type Description
options Object Options parameter in query object.

giscloud.Queuetop

Constructor

Constructor Usage Description
giscloud.Queue() new giscloud.Queue() Default constructor

Methods

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

giscloud.Viewertop

Defines map viewer and it’s also space for showing all layers and 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);
            }
            

See live demo on links below

Constructor

Constructor Usage Description
giscloud.Viewer( <String> containerId, <Number> mapId, <Object> options ) new giscloud.Viewer() Creates a new Viewer.

Methods

Method Returns Description
addMarker( <giscloud.Marker> marker ) this Adds a marker to the map viewer.
areaZoom() this Makes active area zoom tool.
bind( <String> eventName, <Function> handler ) this Binds an event handler.
bounds( <giscloud.Bounds> bounds ) get:giscloud.Bounds, set:this 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.
boundsChange( <Function> handler ) this If bounds are changed call function.
center( <giscloud.LonLat> center, <Number> zoomLevel ) get:giscloud.LonLat, set:this 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.
container( <String> containerId ) set:this, get:container Gets or sets map viewer container.
doubleClick( <Function> callback ) this Event handler function for the viewer doubleClick event.
dragEnd( <Function> handler ) this Binds a viewer dragEnd event handler.
editAccept() this If in edit mode accepts the changes.
editCancel() this If in edit mode cancels the changes.
editFeature( <Number> layerId, <Number> featureId, <Object> options ) giscloud.Promise Start editing specified feature in a specified layer.
featureClick( <Function> handler ) this Binds a feature click event handler.
featureDoubleclick( <Function> handler ) this Binds a feature click event handler.
featureOut( <Function> handler ) this Binds a feature hover our event handler.
featureOver( <Function> handler ) this Binds a feature hover event handler.
filterFeatures( <Number> layerId, <Object> filter ) void 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;}
fullExtent() this Zooms to map full extent.
getRenderParams( <Number> scale ) Object Returns render parameters, image scale factor, image width(px) and height(px).
height( <Number> height ) get:Number, set:this 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.
hideLayer( <Number> layerId ) this Hides a layer.
hideLayerLabels( <Number> layerId ) this Hides a layer’s labels.
hideTip() this Hides the tooltip.
init( <Function> handler ) this Binds an event that fires upon viewer initialization.
layerById( <Number> layerId ) giscloud.ViewerLayer Gets a giscloud.ViewerLayer with the specified id.
loadMap( <Number> mapId, <Function> callback, <Boolean> startBounds ) giscloud.Viewer Loads a new map into the viewer.
measure() this Makes active measure tool.
mouseDown( <Function> handler ) this Binds an event that fires upon mouse down event.
mouseMove( <Function> handler ) this Binds an event that fires upon mouse move event.
mouseUp( <Function> handler ) this Binds an event that fires upon mouse up event.
pan() this Makes active pan tool.
ready( <Function> handler ) this Binds an event that fires upon the map viewer is ready.
reloadMap() this Reloads the map.
removeMarker( <giscloud.Marker> marker ) this Remove the marker.
scale( <Number> scale ) get:Number, set:this 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.
scaleChange( <Function> handler ) this Binds an event that fires upon the map scale (zoom) has changed.
select( <Boolean> onoff ) this Enabled/disables map selection.
selectFeature( <Number> layerId, <Number>featureId, <Boolean> highlight ) this Selects a feature and optionally highlights it.
selectFeaturesByBounds( <Number> layerId, <giscloud.Bounds> bounds, <Boolean> clear? ) this Select features by bounds. Optionally clears already active selection.
selectionChange( <Function> handler ) this Binds an event that fires upon selection has changed.
showLayer( <Number> layerId ) this Shows a layer.
showLayerLabels( <Number> layerId ) this Shows layer’s labels.
showTip( <String> text ) this Shows the tooltip.
unbind( <String> eventName, <Function> handler ) this Unbinds an event handler.
width( <Number> width ) get:Number, set:this 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.
zoomToCurrentLocation() this Function zooms on map to your current location using browsers geolocation.
zoomToLayer( <Number> layerId ) this Zooms to a layer’s extent.

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.

giscloud.ViewerLayertop

Constructor

Constructor Usage Description
giscloud.ViewerLayer( <Object> object ) new giscloud.ViewerLayer() Creates viewer layer.

Methods

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

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.ViewerLayerExpressiontop

Constructor

Constructor Usage Description
giscloud.ViewerLayerExpression( <ViewerLayer> viewer layer, <Object> object ) new giscloud.ViewerLayerExpression() Creates expression viewer layer.

Methods

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

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.ViewerSelectiontop

Constructor

Constructor Usage Description
giscloud.ViewerSelection( <giscloud.Viewer> viewer ) new giscloud.ViewerSelection() Represents a selection of features on the viewer map.

Methods

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

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.bookmarkstop

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

Methods

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

giscloud.datasourcestop

        //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: , //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: "http://editor.giscloud.com/wms/450a77de8b3cace9fcc3c3bd39ccaa86"
            }
        };
        giscloud.datasources.create(data) //create new data source
        .done(function (data) {
            console.log(data);
        });
        

Methods

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

Properties

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

giscloud.datasources.Datasourcetop

Constructor

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

Methods

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

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.datasources.wmstop

        //print list of projections used in map with defined wms url

        giscloud.datasources.wms
        .getCapabilities("http://editor.giscloud.com/wms/346c5724511c16b7faffa35cfce2f7b6", "1.3.0")
        .done(function (data) {
            console.log(data.srs);
        });
        

Methods

Method Returns Description
giscloud.datasources.wms.getCapabilities( <String> wmsURL, <String> wmsVersion ) String XML Returns getCapabilities response from a wmsURL WMS server.
giscloud.datasources.wms.getFeatureInfo( <Number> layerId, parameters ) <giscloud.Promise> Returns informations about feature.

giscloud.datetop

        //print number of days in July 2014

        var numberOfDays = giscloud.date.daysInMonth(7,2014);
        parseInt(numberOfDays); //return number of days in July, 2014 year
        

Methods

Method Returns Description
giscloud.date.daysInMonth( <Number> month, <Number> year ) Date Constructs Date object from month year
giscloud.date.generateTimeline( <Array> years, <Boolean> showDays, <Number> step, <Boolean> dontGoInFuture ) Array Generate Timeline array.
giscloud.date.getTimelineDateIndex( <Array> timeLineArray, <Number> timestamp ) Number Returns index of a timestamp in the timeline.

giscloud.featurestop

        //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);
        
        //print number of features in defined bounds

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

        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);
        
        //print feature geometry from feature which attribute "name" is equal to "John"

        giscloud.features.byLayer(994, {where: "name='John'", geometry: 'wkt'})
        .done(function (features) {
            console.log(features[0].geometry);
        });
        

Methods

Method Returns Description
giscloud.features.byBounds( <Number> layerId, <giscloud.Bounds> bounds, <Function> callback ) giscloud.Promise 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.
giscloud.features.byId( <Number> layerId, <Number> featureId, <Object> options?, <Function> callback ) giscloud.Promise This method will retrieve feature data for a specified feature id.
giscloud.features.byLayer( <Number> layerId, <Object> options, <Function> callback ) giscloud.Promise This method fetches a list of features belonging to the specified layer from GIS Cloud and passes it to the callback function.
giscloud.features.create( <Number> layerId, <Object> data ) giscloud.Promise This creates a new feature in a desired layer. Input is object containing feature data. The geometry property sets the geometry; use WKT here.
giscloud.features.email( <Object> options ) giscloud.Promise Email features to usernames and/or emails. Options: layer_id, feature_ids (Array), usernames (Array), emails (Array)
giscloud.features.emailCSV( <Object> options ) giscloud.Promise Email features.csv to emails. Options: layer_id and emails (Array).
giscloud.features.remove( <Number> layerId, <Number> featureId ) giscloud.Promise Deletes feature featureId from layer layerId.
giscloud.features.update() giscloud.Promise 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.

giscloud.filestop

        // 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( fileId)
        .done(out);
        

Methods

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

giscloud.formatstop

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.exportFormatstop

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.renderFormatstop

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.formstop

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

Methods

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

giscloud.geometrytop

        //print geometry in OGC Simple Features WKT

        var point = new giscloud.geometry.Point(-6140.0432, 6709200.4413); //giscloud point object
        giscloud.geometry.toOGC(point);
        

See live demo on links below

Methods

Method Returns Description
giscloud.geometry.fromGeoJSON( <Object> geojson ) giscloud.geometry.Geometry (Point, Line, Polygon, ...) Converts GeoJSON format into a giscloud.geometry e.g. giscloud.geometry.Point
giscloud.geometry.fromOGC( <String> WKT ) giscloud.geometry.Geometry (Point, Line, Polygon, ...) Converts WKT format into a giscloud.geometry e.g. giscloud.geometry.Point
giscloud.geometry.hasZ() Boolean Checks if geometry has Z coordinate.
giscloud.geometry.toOGC() WKT Gets a GeometryCollection geometry object string in OGC Simple Features WKT (well-known text).

giscloud.geometry.GeometryCollectiontop

Constructor

Constructor Usage Description
giscloud.geometry.GeometryCollection( <giscloud.geometry.*> geometries ) new giscloud.geometry.GeometryCollection() Creates a new geometry collection.

Methods

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

Properties

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

giscloud.geometry.Linetop

            //create giscloud line object

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

Constructor

Constructor Usage Description
giscloud.geometry.Line( <Array of <giscloud.Point>> points ) new giscloud.geometryLine() Creates a new line.

Methods

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

Properties

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

giscloud.geometry.Multilinetop

            //create giscloud multiline object

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

Constructor

Constructor Usage Description
giscloud.geometry.Multiline( <Array of <giscloud.Line>> lines ) new giscloud.geometry.Multiline() Creates a new multiline.

Methods

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

Properties

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

giscloud.geometry.Multipointtop

            //create giscloud multipoint object

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

Constructor

Constructor Usage Description
giscloud.geometry.Multipoint( <Array of <giscloud.Point>> points ) new giscloud.geometry.Multipoint() Creates a new multipoint.

Methods

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

Properties

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

giscloud.geometry.Multipolygontop

            //create giscloud multipolygon object

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

Constructor

Constructor Usage Description
giscloud.geometry.Multipolygon( <Array of <giscloud.Polygon>> polygons ) new giscloud.geometry.Multipolygon() Creates a new multipolygon.

Methods

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

Properties

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

giscloud.geometry.Pointtop

            //create giscloud point object

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

Constructor

Constructor Usage Description
giscloud.geometry.Point( <Number> x, <Number> y, <Number> z ) new giscloud.geometry.Point() Creates a new point.

Methods

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

Properties

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

giscloud.geometry.Polygontop

            //create giscloud polygon object

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

Constructor

Constructor Usage Description
giscloud.geometry.Polygon( <Array of <giscloud.Line>> rings ) new giscloud.geometry.Polygon() Creates a new polygon.

Methods

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

Properties

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

giscloud.geoutilstop

        // print number of features at defined point in two layers

        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, [, , ...], {srid: 900913, operation: "within"}).done(out);

        
        // print number of point features (in layer with id 1078) within polygon (in layer with id 1071, feature id 8)

        giscloud.geoutils.spatialFilter(JSON.stringify({"1071": [8]}), [1078], {operation: "within"})
        .done(function (e) {
            console.log(e.length);
        });
        

Methods

Method Returns Description
giscloud.geoutils.area( <giscloud.GraphicFeature> graphicFeature, <String> geometrySrid, <String> outputSrid, <Function> callback ) giscloud.Promise Returns area in string format.
giscloud.geoutils.featureArea( <Number> layerId, <Number> featureId, <String> geometrySrid, <String> outputSrid, <Function> callback ) giscloud.Promise Returns feature area in string format.
giscloud.geoutils.featuresAtPoint( <giscloud.LonLat> position, <Number> layerIds, <Object> options, <Function> callback ) giscloud.Promise Finds features across given layers that intersect with a given point.
giscloud.geoutils.featuresAtPointForMap( <giscloud.LonLat> position, <Number> mapId, <Object> options ) giscloud.Promise Finds features in a given map that intersect with a given point.
giscloud.geoutils.merge()
giscloud.geoutils.spatialFilter( <giscloud.geometry.*> filterGeometry, <Number> layerIds, <Object> options, <Function> callback ) giscloud.Promise Filter for spatial data. Define geometry for filtering with ‘filterGeometry’.

giscloud.keystop

        //create new API key

        giscloud.keys.add("write_some_description");
        

Methods

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

giscloud.layerstop

        //print map id for chosen layer id

        giscloud.layers.byId(8, function(layer) {
            console.log(layer.mapId); //print mapId
        });
        

Methods

Method Returns Description
giscloud.layers.byId( <Number> layerId, <Function> callback ) giscloud.Promise This method will retrieve layer data for a specified layer id.
giscloud.layers.byMapId( <Number> mapId, <Function> callback ) giscloud.Promise This method fetches a list of layers belonging to the specified map from GIS Cloud and passes it to the callback function.
giscloud.layers.create( <Object> data ) giscloud.Promise 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.
giscloud.layers.export( <Number> layerId, <String> exportFormat, <Boolean> zip ) String("URL") Returns URL that can be used to export layerId into an exportFromat
giscloud.layers.list( <Function> callback ) giscloud.Promise This method fetches a list of layers from GIS Cloud and passes it to the callback function.
giscloud.layers.remove( <Number> layerId ) giscloud.Promise Deletes layer layerId
giscloud.layers.render( <Number> layerId, <String> format, <Number> width, <Number> height ) String("URL") Returns URL that can be used to render layerId as an png, iframe
giscloud.layers.reset( <Number> mapId, <Number> layerId ) giscloud.Promise Reinitializes (tiles) for layer layerId in a map mapId.
giscloud.layers.update( <Number> layerId, <Object> data ) giscloud.Promise Use this method to update a layer already in the cloud.

giscloud.layers.attributeOpstop

        //print list of attribute values for chosen layer

        var options = {
            perpage: 5,
            page: 1
        };
        giscloud.layers.attributeOps.distinct(733107, "attribute1", options)
        .done(function (data) {
            console.log(data.data); //list of attribute values
        });
        

Methods

Method Returns Description
giscloud.layers.attributeOps.distinct( <Number> layerId, <String> attribute, <Object> options ) giscloud.Promise Performs a distinct or ranges query on an attribute from a given layer.
giscloud.layers.attributeOps.info()

giscloud.mapstop

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

        

Methods

Method Returns Description
giscloud.maps.byId( <Number> mapId, <Function> callback ) giscloud.Promise This method will retrieve map data for a specified map id.
giscloud.maps.create( <Object> data ) giscloud.Promise 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.
giscloud.maps.list( <Object> options?, <Function> callback ) giscloud.Promise This method grabs a list of maps from GIS Cloud and passes it to the callback function.
giscloud.maps.remove( <Number> mapId ) giscloud.Promise Deletes map mapId
giscloud.maps.reset( <Number> mapId, <Number> layerIds ) giscloud.Promise Reinitializes (tiles) for layer layerIds in a map mapId.
giscloud.maps.update( <Number> mapId, <Object> data ) giscloud.Promise Use this method to update a map already in the cloud.
giscloud.maps.users( <Number> mapId ) giscloud.Promise Returns list of users that have access to map mapId.

giscloud.oauth2top

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.

        //create login button in 'login' container

        //apiKey is generated by Gis Cloud, you can make your own application on
        //My Account -> API access -> Applications
        giscloud.oauth2.authorize(apiKey, function() {
            giscloud.oauth2.button("login");
        });
        

Methods

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

giscloud.optionstop

        // Create and/or update resource options
        giscloud.options.create(RESOURCE_ID, {option_name: "OPTION_NAME", option_value: "OPTION_VALUE"}).done(out);

        // List
        giscloud.options.list(RESOURCE_ID).done(out);

        // Delete
        giscloud.options.remove(RESOURCE_ID).done(out);
        

Methods

Method Returns Description
giscloud.options.byId( <Number> option id, <Object> options, <Function> callback ) giscloud.Promise Returns option by id.
giscloud.options.byName( <Number> user id, <String> option name, <Function> callback ) giscloud.Promise Returns option by option name.
giscloud.options.create( <Number> target, <Object> data ) this Create resource options.
giscloud.options.list( <Object> options ) giscloud.Promise List options.
giscloud.options.remove( <Number> option id ) giscloud.Promise Remove option using option id.
giscloud.options.update( <Number> option id, <Object> options, <Object> data ) giscloud.Promise Update resource option.

giscloud.permissionstop

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.proxytop

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

Methods

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

giscloud.searchtop

        //find features with condition:
        //    - layer id is equal to 1061
        //    - one of attributes has a value that is equal to or contains a word "Hydrophis" 
        //    - result is in projection EPSG4326

        giscloud.search.features("Hydrophis", "1061~*", {proj4: "proj4 format", srid: 4326})
        .done(out);
        

Methods

Method Returns Description
giscloud.search.features( <String> query, <String> fields, <giscloud.LonLat> location, <Object> options, <Function> callback ) giscloud.Promise Returns list of features.

giscloud.spatialrelationshiptop

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

Methods

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

giscloud.storage.dbtop

        // import file 'test.csv' in database

        giscloud.storage.db.import({
            filename: "test.csv",
            tablename: "newTable", 
            geometryColumn: "geometry", 
            geometrySRS:"EPSG:4326", 
            geometryFormat:"wkt",
            ifExists: "overwrite"
        });
        

Methods

Method Returns Description
giscloud.storage.db.import( <Object> options ) giscloud.Promise Imports file in database. Options are: filename, tablename, geometryColumn, geometryColumns, geometrySRS, geometryFormat, geometryType, ifExists.

giscloud.tablestop

        // 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" },
                "CustomNumber": { "type": "!real" }
            }
        };

        // 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
        });
        
        //create a new table using GIS Cloud Tables join method

        var firstTable = "table1"; // here goes first table name
        var secondTable = "table2" // here goes second table name
        var viewName = "tableNew" // here goes a new table name
        var on = {
            source_field: "column1", // column name from first table
            operator: "=", // operator
            target_field: "column2" // column name from second table
        };
        var idFields = {
            source: "column3", // column name from first table
            target: "column4" // column name from second table
        };
        var fields = null;
        var joinType = "LEFT"; // default is also LEFT

        giscloud.tables.join(firstTable, secondTable, viewName, on, idFields, fields, joinType)
        .done(function (result) {
            console.log(result); // print a list of new tables with methods
        });
        

Methods

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

giscloud.tables.rowstop

        // list rows in polygon table and print rows (without geometry) and number of rows
        // possible values for geometry param: false | 'wkt' | 'wkb'

        giscloud.tables.rows.list("polygon", {geometry: false})
        .done(function (rows) {
            console.log(rows);
            console.log(parseInt(rows.total));
        });

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

        

Methods

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

giscloud.uitop

        //check if user is logged in

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

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

Methods

Method Returns Description
giscloud.ui.checkLogin() Boolean Checks if a user is logged in. If not it displays a proper message.
giscloud.ui.confirm( <String> html, <Object> options ) this 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.
giscloud.ui.filters( <Object> filters, <DOM> target, <Object> options ) this Creates filter object.
giscloud.ui.fullScreen( <Object> options ) this Opens form manager in full screen.
giscloud.ui.greenAlert( <String> msg, <Number> duration ) this Creates green alert.
giscloud.ui.id() String Generates new id.
giscloud.ui.inlineEdit( <DOM> selector, <Object> options ) this Initializes inline editing on DOM element.
giscloud.ui.modal( <Object> options ) this Creates modal window.
giscloud.ui.newWindow() giscloud.Promise Opens new window.
giscloud.ui.openMap( <Number> mapId ) Loads a specified map.
giscloud.ui.popup( <Object> options ) this Opens popup window.
giscloud.ui.prompt( <String> message, <String> value, <String> title, <String> placeholder, <DOM> container ) giscloud.Promise Prompts for a value.
giscloud.ui.redAlert( <String> msg, <Number> duration ) this Creates red alert.
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

giscloud.ui.FeatureDatagridtop

            // create new FeatureDatagrid 

            var viewer = new giscloud.Viewer("mapViewer", ),
            
            featuregrid = new giscloud.ui.FeatureDatagrid(, {
                viewer: viewer,
                activeLayerId: ,
                datagridOpts:{
                    "ordering": true
                },
                orderBy: {
                    orderByLayerId: ,
                    orderByExpression: 
                }
            });               
            

See live demo on links below

Constructor

Constructor Usage Description
giscloud.ui.FeatureDatagrid( <HTML element> element, <Object> options ) new giscloud.ui.FeatureDatagrid() Creates a new FeatureDatagrid.

Methods

Method Returns Description
add()
bind( <String> eventName, <Function> handler ) this Binds an event handler.
remove()
toolChange()
unbind( <String> eventName, <Function> handler ) this Unbinds an event handler.

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
tools Object
viewer

giscloud.ui.Toolbartop

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

See live demo on links below

Constructor

Constructor Usage Description
giscloud.ui.Toolbar( <Object> options ) new giscloud.ui.Toolbar() Creates a new toolbar.

Methods

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

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.

giscloud.ui.defaultToolstop

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

Method Returns Description
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.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.userstop

        //Create new GIS Cloud user

        giscloud.users.create({username: 'username', email: 'email', password: giscloud.md5('password'), firstname: 'first name', lastname: 'lastname'})
        .done(out);
        
        //Remove GIS Cloud user

        giscloud.users.remove( userId);
        .done(out);
        
        //Update GIS Cloud user by user id

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

Methods

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