Namespace: promises

Mapspace. promises

This namespace contains function helpers that create Promises for long task operations.

Source:
mapspace/bu.jsdoc

Methods


<static> deleteAllExternalProviderTmpBackup()

Returns a Promise that requests DeleteAllExternalProviderTmpBackup service to deleteall the features for any external provider stored in Field services.

Source:
mapspace/promises.js
Returns:

A Promise that returns for the response function or an Error for the reject function.

Type
Promise

<static> deleteUserWorkspace(name)

Returns a Promise that request a deletion to the DeleteUserWorkspace service, removing a workspace in the server.

Parameters:
Name Type Description
name string

The name of the workspace to remove.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string for the resolve function or an error for the reject function. The string of the resolve function is just a message indicating that the deletion was correct.

Type
Promise

<static> findProjections(text)

Returns a Promise that returns an array of Mapspace.ProjectionDefinition that contain data of available projections.

Parameters:
Name Type Description
text string

The text to use to search for projections. It can be a EPSG number (as a string and without prefixing with 'EPSG:') or can be any portion of a name.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of Mapspace.ProjectionDefinition for the resolve function and an Error for the reject function. If the promise resolves the projection information is cached in Mapspace.ProjectionCache. For example, one of the objects returned could be like this:

prjDef = {
 name: 'ETRS89 / NTM zone 5',
 epsg: 5105
}
Type
Promise

<static> getAllScreenShot(workspace)

Returns a Promise that creates a screenshot for each visible viewer in the opened workspace.

Parameters:
Name Type Description
workspace Mapspace.Workspace

The opened workspace.

Source:
mapspace/promises.js
Returns:

Promise that returns an array of canvas elements for the resolve function or an error for the reject function. Canvas elements have the screenshot drawn on them. If one screenshot cannot be created or failed for a viewer then the canvas is null.

Type
Promise

<static> getAllUserData()

Returns a Promise that requests several services, returning the data as an object.

Source:
mapspace/promises.js
Returns:

A Promise that never rejects and returns an object with the user data for the resolve function. The errors, if exist, are added in an errors property in the user data object.

Type
Promise

<static> GetClientDataSize(clientId)

Returns a Promise that request GetClientDataSize service, getting client disk usage.

Parameters:
Name Type Description
clientId number

Client identifier

Source:
mapspace/promises.js
Returns:

A Promise that returns an object with info about disk usage in database for vector layers for the resolve function and an error for the reject function. Disk usage is returned in bytes.

Type
Promise

<static> getDefaultUserWorkspaces()

Returns a Promise that request to the GetDefaultUserWorkspaces service, returning an array of objects representing workspace definitions with the default workspaces for the user.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of objects for the resolve function or an error for the reject function.

Type
Promise

<static> getExternalProviderStats(provider, status, action, time)

Returns a Promise that requests GetExternalProviderStats service to query historical statistical data.

Parameters:
Name Type Argument Description
provider Mapspace.FeatureProviderStore

Provider name.

status Mapspace.FeatureProviderStatus <nullable>

Optional status of the feature in the server.

action Mapspace.FeatureServerActionType <nullable>

Optional type of action performed in the original feature.

time number <nullable>

Optional time filter of the image to be search. A date following the structure YYYYMMDD or YYYYMM or YYYY. The service will use the most current images available, whose date is previous to the requested date. It is also possible to use a range of dates with the structure YYYYMMDD-YYYYMMDD, in this case the images used will be the most current ones available in the specified date range. If the parameter is omitted the system will submit the most recent version of the tile.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of features as they are stored in Field services for the response function or an Error for the reject function.

Type
Promise

<static> getExternalProviderTmpBackup(provider, status, ids, bbox)

Returns a Promise that requests GetExternalProviderTmpBackup service to retrieve all the features for a given external provider stored in Field services.

Parameters:
Name Type Argument Description
provider Mapspace.FeatureProviderStore

Provider name.

status Mapspace.FeatureProviderStatus | Array.<Mapspace.FeatureProviderStatus> <nullable>

Optional status. Can be one value or an array of values.

ids Array.<string> <nullable>

Optional array of IDs to filter the result.

bbox Mapspace.Extent <nullable>

Optional bounding box in EPSG:4326 projection system.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of features as they are stored in Field services for the response function or an Error for the reject function.

Type
Promise

<static> getGenericWMTSOrWMSCapabilities(url, isWMS)

Returns a Promise that requests to any WMS or WMTS GetCapabilities service.

Parameters:
Name Type Description
url string

URL of the WMS or WMTS service.

isWMS boolean

If the service is WMS or WMTS.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array for the resolve function or an Error for the reject function. If returns an array the first value of it is a string ('wms' or 'wmts') indicating the type of service found as valid and the second value of it is an object representing the WMS or WMTS capabilities.

Type
Promise

<static> getMapspaceWFSCapabilities()

Returns a Promise that requests to Mapspace WFS GetCapabilities service.

Source:
mapspace/promises.js
Returns:

A Promise that returns an object representing the WFS capabilities for the resolve function or an Error for the reject function.

Type
Promise

<static> getMapspaceWMTSCapabilities(version)

Returns a Promise that requests to the Mapspace WMTS GetCapabilities service.

Parameters:
Name Type Description
version string

Version of the WMTS service.

Source:
mapspace/promises.js
Returns:

A Promise that returns an object representing the WMTS capabilities for the resolve function or an Error for the reject function.

Type
Promise

<static> getProjDefUsingBlomService(projection)

Returns a Promise that requests a projection definition using Mapspace services.

Parameters:
Name Type Description
projection string | Mapspace.ProjectionInfo

A epsg code like 'EPSG:5110' or 'urn:ogc:def:crs:EPSG::5110', or a Mapspace.ProjectionInfo object containing the previous.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the EPSG code of the projection definition in 'EPSG:xxxx' format for the resolve function and an Error for the reject function. If the promise resolves the projection information is cached in Mapspace.ProjectionCache.

Type
Promise

<static> getProjDefUsingEPSGService(projection)

Returns a Promise that requests a projection definition.

Parameters:
Name Type Description
projection string | Mapspace.ProjectionInfo

A epsg code like 'EPSG:5110' or 'urn:ogc:def:crs:EPSG::5110', or a Mapspace.ProjectionInfo object containing the previous.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the EPSG code of the projection definition in 'EPSG:xxxx' format for the resolve function and an Error for the reject function. The EPSG code can later be used to invoke later proj4 to do reprojections. If the promise resolves the projection information is cached in Mapspace.ProjectionCache.

Type
Promise

<static> getProjectionTransformFn(fromProj, toProj)

Returns a Promise that returns a transformation function between two projections. Projection parameters can be a epsg code like 'EPSG:5110' or 'urn:ogc:def:crs:EPSG::5110', or a Mapspace.ProjectionInfo object containing the previous.

Parameters:
Name Type Description
fromProj string | Mapspace.ProjectionInfo

Projection of origin.

toProj string | Mapspace.ProjectionInfo

Projection of destination.

Source:
mapspace/promises.js
Returns:

A Promise that returns a ol.TransformFunction or null (if projections are the same) for the resolve function and an Error for the reject function.

Type
Promise

<static> getReverseGeocoding(point, zoom_level, srs)

Returns a Promise that request to the SEInvAddress service, returning the address for a given point defined by its coordinates.

Parameters:
Name Type Description
point Mapspace.Coordinate

Point in which search for reverse geocoding.

zoom_level number

Map view zoom level.

srs string

Spatial Reference System of the point projection in EPSG:XXXX format.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string representing the reverse geocoding for the resolve function or an Error for the reject function.

Type
Promise

<static> getScreenShot(viewer)

Returns a Promise that creates a screenshot for a visible viewer.

Parameters:
Name Type Description
viewer Mapspace.Viewer

Viewer.

Source:
mapspace/promises.js
Returns:

A Promise that returns a canvas element for the resolve function or an error for the reject function. The canvas element will have the screenshot drawn on it.

Type
Promise

<static> getTeg(tegid, id)

Returns a Promise that request GetTeg service, recovering a Teg file.

Parameters:
Name Type Description
tegid string

Teg identifier

id string

Tile quadtree identifier

Source:
mapspace/promises.js
Returns:

A Promise that returns a Mapspace.TegTileInfo representing the Teg tile for the resolve function or an Error for the reject function.

Type
Promise

<static> getUserAvailableBaselayers(priority)

Returns a Promise that requests the INUserOrthoLayers service, returning all available baselayers for a certain user.

Parameters:
Name Type Description
priority boolean

If true that indicates that response must respect current user baselayers with order. False must return all available baselayers for all users.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with names of baselayers names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableData(user, x, y, zoom_level, srs, types, yearMode, deliverExtents, includeOverlays)

Returns a Promise that request the GetUserAvailableData service, returning a list of available ortho or oblique layers for a user.

Parameters:
Name Type Description
user string

Userkey of the user to request information for.

x number

X coordinate in the srs reference system.

y number

Y coordinate in the srs reference system.

zoom_level number

Zoom level.

srs string

Spatial Reference System of the origin projection in EPSG:XXXX format.

types Mapspace.BaselayerType

Indicates if request is for ortho or oblique.

yearMode boolean

Indicates if year is requested.

deliverExtents boolean

Indicates if extents is requested.

includeOverlays boolean

Indicates if overlays are requested.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of Mapspace.DatesDefinition for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableDtm3DLayers()

Returns a Promise that request the INGetUserAvailableDtm3DLayers service, returning a list of available DTM 3D layers for a user.

Source:
mapspace/promises.js
Returns:

A Promise that returns an string for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableLidarLayers()

Returns a Promise that requests the INGetUserAvailableLidarLayers service, returning a list of available LiDAR layers for a user.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the layer names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableMesh3DLayers()

Returns a Promise that requests the GetUserAvailableMesh3DLayers service, returning a list of available 3D MEsh layers for a user.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the layer names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableObliqueLayers(priority)

Returns a Promise that requests the INGetUserAvailableObliqueLayers service, returning all available oblique layers for a certain user.

Parameters:
Name Type Description
priority boolean

If true that indicates that response must respect current user oblique layers with order. False must return all available oblique layers for all users.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the layer names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableOverlays()

Returns a Promise that requests the INUserOverlayLayers service, returning all available overlays for a certain user.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with names of overlays names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableProviders()

Returns a Promise that requests a list with de available providers for current user and diferent services. The format of the list is: geocoding_providers_list#routing_providers_list#map_providers_list#pois_providers_list.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the providers for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableStreetLayers(priority)

Returns a Promise that requests the INGetUserAvailableStreetLayers, returning all available street layers for a certain user.

Parameters:
Name Type Description
priority boolean

If priority is true indicates that response must respect current user baselayers with order.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with names of street layer names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserAvailableVectorLayers()

Returns a Promise that requests the GetUserAvailableVectorLayers service, returning an array of available vector layers for a user.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array with the layer names for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserLayers()

Returns a Promise that reequests the GetUserLayers service returning a list of the available User layers for a user. A User layer is an object that contain all necessary information to access a given dataset according to layer (base layer, overlay layer, oblique layer or street layer), date interval (data available between dates) and extent (extension available for a dataset).

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of objects with the user layers for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserLayersFormatList()

Returns a Promise that requests the GetUserLayersFormatList service, returning the list of the id and format type for userLayers.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of objects with the format list for the resolve function and an Error for the reject function.

Type
Promise

<static> getUserProfileInfo(profileId, extentId)

Execute a request to the 'GetUserProfileInfo' service, returning a JSON object that has a 'data' value containing diferent values depending on request parameters. Without parameters, the service returns information about diferent types of profiles. If profileId is used the service returns information about this profile type. If extentId is used the service returns the extent.

Parameters:
Name Type Description
profileId number | null

Id of the profile.

extentId number | null

Id of the extent.

Source:
mapspace/promises.js

<static> getUserStreetProjects()

Returns a Promise that request to the INGetUserStreetProjects service, locating all the Street projects for current user.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of Mapspace.StreetProjectMetadata for the resolve function or an error for the reject function.

Type
Promise

<static> getUserWorkspaceByUserAndName(name)

Returns a Promise that request to the GetUserWorkspaceByUserAndName service, returning an object representing the definition of a given workspace. The object has a description value with the description of the workspace and a definition value with the definition of that workspace.

Parameters:
Name Type Description
name string

The name of the workspace to request for.

Source:
mapspace/promises.js
Returns:

A Promise that returns an one object for the resolve function or an error for the reject function. The object in the resolve function contains two keys: description (with the description of the workspace) and definition (with the serialization of the workspace options).

Type
Promise

<static> getUserWorkspaceInfo(name)

Returns a Promise that request to the GetUserWorkspaceByUserAndName service, returning an array representing the information of user use of measurement and annotation tools.

Parameters:
Name Type Description
name string

The name of the workspace to request for.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array for the resolve function or an error for the reject function. The array in the resolve function contains objects with the info for each viewer in the workspace.

Type
Promise

<static> getUserWorkspacesNames()

Returns a Promise that request to the GetUserWorkspacesNames service, returning an array of objects representing workspaces availables for the user. Each object has a name value with the name of the workspace and a last_modification value with the date and time of last modification of that workspace.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of objects for the resolve function or an error for the reject function. The objects in the resolve function contains two keys: name (with name of the workspace) and last_modification (with date of last modification as string).

Type
Promise

<static> insertDefaultUserWorkspaces(onlyDefault)

Returns a Promise that request several inserts in the InsertUserWorkspace service with all the default user workspaces, if no workspace exists with the name of defaults.

Parameters:
Name Type Description
onlyDefault boolean

If true then only the workspace called Mapspace.DEFAULT_WORKSPACE is attempted to be inserted. If false all default workspaces are added, no matter its name.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of string for the resolve function or an error for the reject function. The array of string of the resolve function is the names of default workspaces that finally where inserted.

Type
Promise

<static> insertUserWorkspace(name, description, definition)

Returns a Promise that request an insert to the InsertUserWorkspace service, inserting a workspace in the server.

Parameters:
Name Type Description
name string

The name of the workspace to insert.

description string

The description of the workspace.

definition string

The JSON serialization of the workspace options.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string for the resolve function or an error for the reject function. The string of the resolve function is just a message indicating that the insert was correct.

Type
Promise

<static> login(user, pwd, userkey)

Returns a Promise that request to the Login service.

Parameters:
Name Type Description
user string

User name.

pwd string

Password. User name and password are encripted previously to send the data.

userkey string

Userkey. If present then user and pwd are ignored and the userkey is used instead as the only param to login.

Source:
mapspace/promises.js
Returns:

A Promise that returns a Mapspace.UserData object for the resolve function and an Error for the reject function.

Type
Promise

<static> logout()

Returns a Promise that request to the Logout service.

Source:
mapspace/promises.js
Returns:

A Promise that returns true for the resolve function and an Error for the reject function.

Type
Promise

<static> parseJSON(evt)

Returns a Promise that parses a JSON contained in an Event object triggered by an XMLHttpRequest.

Parameters:
Name Type Description
evt Event

The event object.

Source:
mapspace/promises.js
Returns:

A Promise that returns an object for the resolve function, or an error for the reject function.

Type
Promise

<static> parseTXT(evt, numValues, errorText, splitChar, first, asFloat)

Returns a Promise that parses a string contained in an Event object triggered by an XMLHttpRequest.

Parameters:
Name Type Argument Description
evt Event

The event object.

numValues number <nullable>

An optional value with the number of expected values separated by commas in the result. If no present then any number of values is correct, included no value at all. If present an error will be passed to the reject function if the number do not match the result.

errorText string <nullable>

An optional string that if it is contained in the response then it is considered an error and the response should be sent to the reject function.

splitChar string <nullable>

An optional string to use to split the response instead of using the default , comma. If it is used an empy string '', then instead of splitting the response, the response will be returned as it is without splitting it.

first boolean <nullable>

Optional boolean indicating if return only first value if there is several, or all values. Default is all values.

asFloat boolean <nullable>

Optional boolean indicating if return the value parsed to float or as string. Only used when first is true. Default is false.

Source:
mapspace/promises.js
Returns:

A Promise that returns an array of strings or only one string for the resolve function, or an error for the reject function.

Type
Promise

<static> reflectPromise(promise)

Returns a new Promise using the given one that always is settled and that returns a fulfillment value object that contains one of these two values: value if the promise is resolved and error if the promise is rejected. This new type of promise is useful for making a Promise.all promise that iterates through all the promises even if one rejects.

Parameters:
Name Type Description
promise Promise

Promise to reflect.

Source:
mapspace/promises.js
Returns:
Type
Promise

<static> reprojectSources(sources)

Returns a Promise that creates a new array of reprojected sources from a given array of sources.

Parameters:
Name Type Description
sources Array.<Mapspace.source.Vector>

Input sources.

Source:
mapspace/promises.js
Returns:

A Promise that returns a new array of source for the resolve function or an Error for the reject function.

Type
Promise

<static> saveExternalProviderTmpBackup(provider, status, action, feature)

Returns a Promise that requests the SaveExternalProviderTmpBackup service, saving a feature in Field services.

Parameters:
Name Type Description
provider Mapspace.FeatureProviderStore

Provider name.

status Mapspace.FeatureProviderStatus

Status o the feature in the server.

action Mapspace.FeatureServerActionType

Type of action performed in the original feature.

feature ol.Feature

The feature to save with a geometry in Spherical Mercator projection.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string with the ID of feature in Field services database for the resolve function and an Error for the reject function.

Type
Promise

<static> setUserPreferences()

Returns a Promise that request to the SetUserPreferences service.

Source:
mapspace/promises.js
Returns:

A Promise that returns true for the resolve function and an Error for the reject function.

Type
Promise

<static> updateExternalProviderTmpBackup(id, status, action, feature)

Returns a Promise that requests UpdateExternalProviderTmpBackup service, updating a feature in Field services.

Parameters:
Name Type Description
id string

Id of the feature in Field storage services.

status Mapspace.FeatureProviderStatus

Status of the feature in the server.

action Mapspace.FeatureServerActionType

Type of action performed in the original feature.

feature ol.Feature

The feature to save with a geometry in Spherical Mercator projection.

Source:
mapspace/promises.js
Returns:

A Promise that returns an OK message for the resolve function or an Error for the reject function.

Type
Promise

<static> updateUserWorkspace(name, description, definition [, newname])

Returns a Promise that request an update to the UpdateUserWorkspace service, updating a workspace in the server.

Parameters:
Name Type Argument Description
name string

The name of the workspace to update.

description string

The description of the workspace.

definition string

The JSON serialization of the workspace options.

newname string <optional>

An optional new name for the workspace. Leave this empty for not renaming the workspace.

Source:
mapspace/promises.js
Returns:

A Promise that returns a string for the resolve function or an error for the reject function. The string of the resolve function is just a message indicating that the update was correct.

Type
Promise