Click or drag to resize

Telogis.GeoBase

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Telogis.GeoBase Namespace

The encompassing namespace for the entire GeoStream v2.0 JavaScript API. This serves largely as a container for other packages targeted for a more specific role, but also contains common types and utility functions that affect the functionality of the entire library. There are two main types of entity in this library: classes and namespaces. Classes are constructor functions that should be called with the new keyword (managed classes will throw an exception if they are called without it) to create an object with all the properties specified by the class. Most GeoBase classes are managed: they can be inherited from, and undergo several small automatic validations. However, some small classes that are intended to be constructed repeatedly in performance-critical contexts (such as LatLon and Point) are unmanaged, and lack these features. Methods of a class instance should only be called as properties of that instance (or with an apply or call scope adjustment). The following usage is invalid and will generally result in an error:

JavaScript
var instance = new SomeClass ();
var writeCallback = instance.write;
...
writeCallback ('text');

and instead, the following should be written:

JavaScript
var instance = new SomeClass ();
var writeCallback = function (text) {instance.write (text);};
...
writeCallback ('text');

Namespaces are groupings of items with a common purpose. Functions in a namespace are scope-independent, so they may be called by direct reference rather than as properties of the namespace itself (although this latter approach is more common). That is, the following is valid (though it would not be for a class instance):

JavaScript
var writeCallback = SomeNamespace.write;
...
writeCallback ('text');

Notice that many GeoBase objects and classes contain internal properties, marked with a leading '_' character. These objects and classes should never be used directly. Such properties are made inaccessible wherever possible, but sometimes true-private variables are not viable with the use of JavaScript prototypes, in order to allow faster class instantiation.

Classes
NameDescription
AbstractDOMEntityAn abstract base class for constructs that are based on a DOM element, such as map layers and widgets. Primarily, this combines the features of MapLayers.AbstractLayer and Widgets.AbstractWidget to allow code re-use. Note that because of the varying treatments of top-level DOM nodes between these, creation of a base element is left to the derived class.
AuthenticatorUsed to provide authentication services with GeoStream servers using only JavaScript. Necessary when providing GeoStream authentication from non .NET environments or services.
BoundingBoxRepresents a rectangular area between top-left and bottom-right corners, specified as latitude-longitude coordinates. Potentially useful for zooming, or hit-testing a given area.
JavaScript
// Create a BoundingBox in Los Angeles, Ca
var BBox = new Telogis.GeoBase.BoundingBox(
    new Telogis.GeoBase.LatLon(33.587137,-117.742878),
    new Telogis.GeoBase.LatLon(33.575037,-117.724762)
);
CanvasA utility for managing and rendering primitive shapes to a VML (Internet Explorer v8 or less) or SVG (Webkit) element. Shapes are managed as individual entities, as is the style of vector-graphics implementations like VML and SVG, for performance reasons. That is, to draw on a canvas once it has been created, methods to create these primitives should be called (e.g. Canvas.circle, Canvas.rect), but if further manipulation of them is desired (e.g. to clear the Canvas), references to the objects returned by these functions should be kept and have appropriate methods called.
JavaScript
// Create a Canvas instance on a parent DOM element (DIV 'main_map')
var myCanvas = new Telogis.GeoBase.Canvas({
    fillColor: new Telogis.GeoBase.Color(0,18,255,0.5),
    id: 'new_canvas',
    lineColor: new Telogis.GeoBase.Color(0,18,255,0.9),
    lineWidth: 1,
    parent: 'main_map', // DOM entity. In this example the DIV 'main_map'
    size: new Telogis.GeoBase.Size(640,480) // Not needed if already defined
});
ColorRepresents a set of color components in RGB-space, with an optional alpha-value.
DataSetContains information about a data set available on the current GeoStream server.
EventHandlerProvides a way to organize a collection of functions and call them all at once when a certain event occurs. Other EventHandlers can also be queued for execution once the calling handler has been triggered, but less flexibility is available than for functions.
FeatureInfoA wrapper class to contain information about a point of interest in the map data.
GeomUtilContains mathematical utility functions for manipulating spatial data.
LatLonRepresents a latitude-longitude coordinate pair, expressed in degrees (WGS84 World Geodetic System projection).
LineRepresents a non-street line feature, such as a railway, stream or custom line data.
POIA description of a point of interest returned by the server, grouping additional information about it such as name and phone number.
JavaScript
// Create a BoundingBox in Los Angeles
var QueryBox = new Telogis.GeoBase.BoundingBox(
    new Telogis.GeoBase.LatLon(33.893487,-118.252747),
    new Telogis.GeoBase.LatLon(33.886426,-118.234481)
);

var list = '';
var myQuery = ''; // An empty string or null returns all POIs.
// Also accepts partial matches to POI names (not types), for example 'Airport' or 'Museum'.
// Or a full name, such as 'Acme Fish Market' or 'Tasty Cupcakes By Angelo'.

// Query every POI within the BoundingBox
Telogis.GeoBase.DataQuery.queryPOI(QueryBox, null, myQuery, function (result) {
    for (var i = 0; i < result.length; i++) {
        var checkFood = result[i].getFoodType();
        if (checkFood == 'UNKNOWN'){
            checkFood = ' Unknown (this POI does not serve food, or the food available is unknown)';
        }
        list +=  '' + result[i].getName() +
        ' at ' + result[i].getLocation() +
        ' is a POI of type ' +
        result[i].getType() + '\n' +
        ' -- POI summary with phone number: ' + result[i].toString() + '\n' +
        ' -- POI food type: ' + checkFood + '\n' ;
    } alert (list);
}, function (error) {alert(error)});
PointRepresents a 2D spatial coordinate pair.
PointFeatureA PointFeature may be a city from a GeoBase data file, or a point feature from a custom dataset.
PolygonRepresents a closed polygonal map feature such as a lake or national park. Not to be confused with a Geometry.Polygon, which is the physical shape of the Geometry object contained in the geometries array.
RectangleA class to contain a pair of x- and y- coordinates that represent the corners of a rectangle. Analogous to the Rectangle .NET class.
RemoteStreetLinkA wrapper class for containing data about a single street link.
SizeRepresents the 2D spatial dimensions of an object.
SkinAn abstract base class defining functionality common to all types of more specific skin. Primarily, it will manage loading the skin's constituent images.
StreetRepresents a physical street.
XMLDocA class that provides a wrapper around all of the basic required XML functionality to abstract the differences in implementations between web browsers.
Functions
NameDescription
addDataSet (String dataSet)

Adds a named dataset to be used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration.

Arguments
  • dataSet (String) - The name of the dataset to use.

addDataSets ()

Adds named datasets to be used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration.

clearDataSets ()

Clears the list of manually-specified data-sets, causing the GeoStream server to fall back upon its default one.

destroy ()

A global cleanup function that is automatically called when the page unloads. This invokes the destroy functions of the various active GeoBase subsystems, ensuring that memory cycles are broken to avoid leaks, and flushes the event cache.

getAvailableData (Function callback, Object server)

Requests the list of available datasets for the currently authenticated user

Arguments
  • callback (Function) - The function to call once the dataset list has been received from the server.

    Arguments
    • sets (DataSet[]) - The list of datasets.

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

getCopyright (Function callback, Object server)

Requests the copyright string that is displayed on map widgets.

Arguments
  • callback (Function) - The function to call once the copyright string has been received from the server.

    Arguments
    • str (String) - The copyright string itself.

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

getCultures (Function callback, Object server)

Gets the cultures offered by the server.

Arguments
  • callback (Function) - The function to call once the cultures have been received from the server.

    Arguments
    • cultures (Array) - The array of cultures that are supported

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

getDefaultDataSet (Function callback, Object server)

Requests the default dataset for the currently authenticated user

Arguments
  • callback (Function) - The function to call once the default data set has been received from the server.

    Arguments
    • set (DataSet) - The default dataset.

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

getDefaultServers ()

Returns the URLs used to retrieve data from GeoStream servers.

getGeoStreamRenderers (Function callback, Object server)

Get an Array containing all GeoStreamRenderer layers offered by the server.

Arguments
  • callback (Function) - The function to call once the list is returned by the server.

    Arguments
    • renderers (Array) - List of available GeoStreamRenderers.

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

getServerLayers (Function callback, Object server)

Get an Array containing all layers offered by the server.

Arguments
  • callback (Function) - The function to call once the list is returned by the server.

    Arguments
    • layers (Array) - List of available Web Map Service layers. Each layer has a Name, Description, ExpiryMinutes, Type ("Renderer" or "WMS"), RenderMode ("overlay" or "underlay") and Copyright.

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

getUnitSystems ()

Gets the Telogis.GeoBase.Navigation.UnitSystem available.

Returns

Array - An array of valid Telogis.GeoBase.Navigation.UnitSystem strings.

getWMSLayers (Function callback, Object server)

Get an Array containing all Web Map Service (WMS) layers offered by the server.

Arguments
  • callback (Function) - The function to call once the list is returned by the server.

    Arguments
    • layers (Array) - List of available layers. Each layer has a Name, Description, Copyright, RenderMode, Type and ExpiryMinutes.

  • server (Object) - An optional object that contains server.url and server.authToken to be used for this request

removeDataSet (String dataSet)

Removes a named dataset from the list that is used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration.

Arguments
removeDataSets (Array dataSets)

Removes a collection of named datasets from the list that is used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration.

Arguments
setAuthToken (String token, Number duration, boolean setCookie)

Sets the authentication token to be sent with all GeoStream requests. This should be called by the webserver when the page is loaded with an appropriately generated token.

Arguments
  • token (String) - The authentication token to use for request validation.

  • (Optional) duration (Number) - The time, in milliseconds, that the authentication will be valid for. Once this time has elapsed, the Telogis.GeoBase.AuthExpiry event is triggered. Defaults to undefined.

  • setCookie (boolean) - Optional. If true sets a cookie with all serviceURLs.

setDataSet (String dataSet)

Sets the single named dataset that will be used by the GeoStream server when serving map data to this application. If no data sets have been manually specified, the server will use its default one, which depends on its configuration.

Arguments
  • dataSet (String) - The name of the dataset to use.

setDataSets (Array dataSets)

Sets the collection of named datasets that will be used by the GeoStream server when serving map data to this application. If no data sets have been manually specified, the server will use its default one, which depends on its configuration.

Arguments
  • dataSets (Array) - The list of dataset names to use.

setService (Array service)

Changes the URLs used to retrieve data from GeoStream servers. By default, only 'http://localhost/geostream/' is used, but if an array is passed, multiple servers can be queried alternately.

Arguments
  • service (Array or String) - Either a single URL for a server or an array of URLs for multiple servers. The server with the lowest latencey will be used. Each entry in the array of URLs will be a string or an array of strings - to represent multiple domain names for the server. If multiple dommain names are specified, tile requests will be domain sharded evenly between each domain name which may decrease map load time in most environments.

Properties
NameTypeDescription
AuthExpiryEventHandler

An event triggered when the authorization token generated with the page expires, which could potentially occur during the page's lifetime, or otherwise fails.

AuthTokenString

Authentication token returned by the server after successful authentication.