This namespace contains function helpers that create Promises for long task operations.
- Source:
- mapspace/bu.jsdoc
Methods
-
<static> deleteAllExternalProviderTmpBackup()
-
Returns a Promise that requests
DeleteAllExternalProviderTmpBackupservice 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
DeleteUserWorkspaceservice, removing a workspace in the server.Parameters:
Name Type Description namestring 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.ProjectionDefinitionthat contain data of available projections.Parameters:
Name Type Description textstring 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.ProjectionDefinitionfor the resolve function and an Error for the reject function. If the promise resolves the projection information is cached inMapspace.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 workspaceMapspace.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
errorsproperty in the user data object.- Type
- Promise
-
<static> GetClientDataSize(clientId)
-
Returns a Promise that request
GetClientDataSizeservice, getting client disk usage.Parameters:
Name Type Description clientIdnumber 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
GetDefaultUserWorkspacesservice, 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
GetExternalProviderStatsservice to query historical statistical data.Parameters:
Name Type Argument Description providerMapspace.FeatureProviderStore Provider name.
statusMapspace.FeatureProviderStatus <nullable>
Optional status of the feature in the server.
actionMapspace.FeatureServerActionType <nullable>
Optional type of action performed in the original feature.
timenumber <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
GetExternalProviderTmpBackupservice to retrieve all the features for a given external provider stored in Field services.Parameters:
Name Type Argument Description providerMapspace.FeatureProviderStore Provider name.
statusMapspace.FeatureProviderStatus | Array.<Mapspace.FeatureProviderStatus> <nullable>
Optional status. Can be one value or an array of values.
idsArray.<string> <nullable>
Optional array of IDs to filter the result.
bboxMapspace.Extent <nullable>
Optional bounding box in EPSG:4326 projection system.
- Source:
- mapspace/promises.js
Returns:
A Promise that returns an array of
featuresas 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
GetCapabilitiesservice.Parameters:
Name Type Description urlstring URL of the WMS or WMTS service.
isWMSboolean 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
GetCapabilitiesservice.- 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
GetCapabilitiesservice.Parameters:
Name Type Description versionstring 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 projectionstring | Mapspace.ProjectionInfo A epsg code like 'EPSG:5110' or 'urn:ogc:def:crs:EPSG::5110', or a
Mapspace.ProjectionInfoobject 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 projectionstring | Mapspace.ProjectionInfo A epsg code like 'EPSG:5110' or 'urn:ogc:def:crs:EPSG::5110', or a
Mapspace.ProjectionInfoobject 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.ProjectionInfoobject containing the previous.Parameters:
Name Type Description fromProjstring | Mapspace.ProjectionInfo Projection of origin.
toProjstring | Mapspace.ProjectionInfo Projection of destination.
- Source:
- mapspace/promises.js
Returns:
A Promise that returns a
ol.TransformFunctionor 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
SEInvAddressservice, returning the address for a given point defined by its coordinates.Parameters:
Name Type Description pointMapspace.Coordinate Point in which search for reverse geocoding.
zoom_levelnumber Map view zoom level.
srsstring Spatial Reference System of the point projection in
EPSG:XXXXformat.- 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 viewerMapspace.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
GetTegservice, recovering a Teg file.Parameters:
Name Type Description tegidstring Teg identifier
idstring Tile quadtree identifier
- Source:
- mapspace/promises.js
Returns:
A Promise that returns a
Mapspace.TegTileInforepresenting 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
INUserOrthoLayersservice, returning all available baselayers for a certain user.Parameters:
Name Type Description priorityboolean 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
GetUserAvailableDataservice, returning a list of available ortho or oblique layers for a user.Parameters:
Name Type Description userstring Userkey of the user to request information for.
xnumber X coordinate in the
srsreference system.ynumber Y coordinate in the
srsreference system.zoom_levelnumber Zoom level.
srsstring Spatial Reference System of the origin projection in EPSG:XXXX format.
typesMapspace.BaselayerType Indicates if request is for ortho or oblique.
yearModeboolean Indicates if year is requested.
deliverExtentsboolean Indicates if extents is requested.
includeOverlaysboolean Indicates if overlays are requested.
- Source:
- mapspace/promises.js
Returns:
A Promise that returns an array of
Mapspace.DatesDefinitionfor the resolve function and an Error for the reject function.- Type
- Promise
-
<static> getUserAvailableDtm3DLayers()
-
Returns a Promise that request the
INGetUserAvailableDtm3DLayersservice, 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
INGetUserAvailableLidarLayersservice, 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
GetUserAvailableMesh3DLayersservice, 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
INGetUserAvailableObliqueLayersservice, returning all available oblique layers for a certain user.Parameters:
Name Type Description priorityboolean 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
INUserOverlayLayersservice, 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 priorityboolean 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
GetUserAvailableVectorLayersservice, 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
GetUserLayersservice returning a list of the availableUser layersfor a user. AUser layeris 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
GetUserLayersFormatListservice, 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 profileIdnumber | null Id of the profile.
extentIdnumber | null Id of the extent.
- Source:
- mapspace/promises.js
-
<static> getUserStreetProjects()
-
Returns a Promise that request to the
INGetUserStreetProjectsservice, locating all the Street projects for current user.- Source:
- mapspace/promises.js
Returns:
A Promise that returns an array of
Mapspace.StreetProjectMetadatafor the resolve function or an error for the reject function.- Type
- Promise
-
<static> getUserWorkspaceByUserAndName(name)
-
Returns a Promise that request to the
GetUserWorkspaceByUserAndNameservice, returning an object representing the definition of a given workspace. The object has adescriptionvalue with the description of the workspace and adefinitionvalue with the definition of that workspace.Parameters:
Name Type Description namestring 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
GetUserWorkspaceByUserAndNameservice, returning an array representing the information of user use of measurement and annotation tools.Parameters:
Name Type Description namestring 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
GetUserWorkspacesNamesservice, returning an array of objects representing workspaces availables for the user. Each object has anamevalue with the name of the workspace and alast_modificationvalue 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) andlast_modification(with date of last modification as string).- Type
- Promise
-
<static> insertDefaultUserWorkspaces(onlyDefault)
-
Returns a Promise that request several inserts in the
InsertUserWorkspaceservice with all the default user workspaces, if no workspace exists with the name of defaults.Parameters:
Name Type Description onlyDefaultboolean 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
InsertUserWorkspaceservice, inserting a workspace in the server.Parameters:
Name Type Description namestring The name of the workspace to insert.
descriptionstring The description of the workspace.
definitionstring 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
Loginservice.Parameters:
Name Type Description userstring User name.
pwdstring Password. User name and password are encripted previously to send the data.
userkeystring 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.UserDataobject for the resolve function and an Error for the reject function.- Type
- Promise
-
<static> logout()
-
Returns a Promise that request to the
Logoutservice.- 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 evtEvent 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 evtEvent The event object.
numValuesnumber <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.
errorTextstring <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.
splitCharstring <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.firstboolean <nullable>
Optional boolean indicating if return only first value if there is several, or all values. Default is all values.
asFloatboolean <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:
valueif the promise is resolved anderrorif 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 promisePromise 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 sourcesArray.<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
SaveExternalProviderTmpBackupservice, saving a feature in Field services.Parameters:
Name Type Description providerMapspace.FeatureProviderStore Provider name.
statusMapspace.FeatureProviderStatus Status o the feature in the server.
actionMapspace.FeatureServerActionType Type of action performed in the original feature.
featureol.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
SetUserPreferencesservice.- 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
UpdateExternalProviderTmpBackupservice, updating a feature in Field services.Parameters:
Name Type Description idstring Id of the feature in Field storage services.
statusMapspace.FeatureProviderStatus Status of the feature in the server.
actionMapspace.FeatureServerActionType Type of action performed in the original feature.
featureol.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
UpdateUserWorkspaceservice, updating a workspace in the server.Parameters:
Name Type Argument Description namestring The name of the workspace to update.
descriptionstring The description of the workspace.
definitionstring The JSON serialization of the workspace options.
newnamestring <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