Click or drag to resize

Telogis.GeoBase.GeoStream

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

Contains helper methods for sending requests to the GeoStream server.

Classes
NameDescription
GeoStream.JSONRequestA wrapper class for containing data relating to GeoStream server requests. This is used as a container to implicitly pass method and authentication information to the server.
GeoStream.JSONResponseA wrapper class that contains information returned from the GeoStream server.
GeoStream.ServerExceptionInfoA class to be filled with error information from the server.
Functions
NameDescription
beginRequest (String name, Function callback, Function errorCallback, Function action, Function cleanup)

Assigns a requestId and registers a callback associated with a request.

Arguments
  • name (String) - A descriptive name for the request - used for logging.

  • callback (Function) - An arbitrary function that uses the result of the request, called only if the request succeeds.

  • errorCallback (Function) - The arbitrary function to be called if the request fails.

  • action (Function) - An arbitrary function to be called to perform the request.

    Arguments
    • req (Request) - A object representing the request.

  • cleanup (Function) - An optional function called to perform clean up of the request.

    Arguments
    • req (Request) - A object representing the request.

callback (String id)

Finds a re-entry point for data to be returned from a GeoStream server-side invocation. References to this callback are then removed.

Arguments
  • id (String) - An ID for the appropriate callback to pass the returned data to.

Returns

Function - A wrapper to the callback associated with the request ID.

destroy ()

Deallocates resources used by the GeoStream subsystem when the page unloads.

getCallbackUrl (String url, Integer id)

Adds a callback specification to a given URL. The callback specification will be prepended to the servers response allowing the response to be executed directly.

Arguments
  • url (String) - The original request url.

  • id (Integer) - The request id.

invoke (String type, String method, Array params, Function callback, Function errorCallback, Number timeout, Object server)

Makes a remote call to one of the GeoStream servers.

Arguments
  • type (String) - The type of service to request. This should be one of GeoStream.GEOCODER_PAGE, GeoStream.ROUTING_PAGE and GeoStream.SETTINGS_PAGE.

  • method (String) - The name of the method in the application to invoke.

  • params (Array or Object) - The list of argument objects to serialize and pass to the server, or a single such object.

  • callback (Function) - An arbitrary callback function to call that uses the result of the request.

  • (Optional) errorCallback (Function) - An arbitray callback function to execute if an error or timeout occurs when making the request. Defaults to null.

    Arguments
    • error (Telogis.Errors.GeoBaseError) - An exception describing the problem that was encountered by the request.

  • (Optional) timeout (Number) - If errorCallback is given, this specifies the amount of time, in milliseconds, to wait for a fetched script before dismissing it as having timed out. Defaults to GeoStream.REQUEST_TIMEOUT.

  • server (Object) - An optional object that contains server.url (The address of the GeoStream server as a string) and server.authToken (The GeoStream authentication token to be used for requesting tiles) to be used for this request.

register (String authToken, String[] serviceURLs, Function[] callbacks, boolean setCookie)

Registers the given authentication token with each server by running its registration page, which will create an HTTP cookie to be checked henceforth by all requests to that server.

Arguments
  • authToken (String) - Optional. The GeoStream authentication token generated with the page.

  • serviceURLs (String[]) - Optional. A list of URLs for the tile servers to register with. Defaults to the current service.

  • callbacks (Function[]) - Optional. An array of callbacks to be invoked when the registration completes. Defaults to registrationCallbacks.

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

runGetScript (String name, String url, Function callback, Function errorCallback, Number timeout)

Sends an HTTP GET request to a given URL, deserializes the response and invokes a callback with the result.

Arguments
  • name (String) - A descriptive name for the request - used for logging.

  • url (String) - The url to post to.

  • (Optional) callback (Function) - A callback to execute once the script has been fetched and executed. Defaults to null.

  • (Optional) errorCallback (Function) - A callback to execute if an error occurs while fetching the script. Defaults to null.

    Arguments
    • error (Error) - The error that occurred.

  • (Optional) timeout (Number) - If timeoutCallback is given, this specifies the amount of time, in milliseconds, to wait for a fetched script before dismissing it as having timed out. Defaults to GeoStream.REQUEST_TIMEOUT.

runPostScript (String name, String url, String postData, Function callback, Function errorCallback, Number timeout)

Sends an HTTP POST request to a given URL, deserializes the response and invokes a callback with the result.

Arguments
  • name (String) - A descriptive name for the request - used for logging.

  • url (String) - The url to post to.

  • postData (String) - Post data to send to the server.

  • (Optional) callback (Function) - A callback to execute once the script has been fetched and executed. Defaults to null.

  • (Optional) errorCallback (Function) - A callback to execute if an error occurs while fetching the script. Defaults to null.

    Arguments
    • error (Error) - The error that occurred.

  • (Optional) timeout (Number) - If timeoutCallback is given, this specifies the amount of time, in milliseconds, to wait for a fetched script before dismissing it as having timed out. Defaults to GeoStream.REQUEST_TIMEOUT.

sendPostScript (String name, String url, String postdata, Function callback, Function errorCallback, Number timeout, Function preSendCallback)

Sends an HTTP POST request to a given URL, deserializes the response and invokes a callback with the result.

Arguments
  • name (String) - A descriptive name for the request - used for logging.

  • url (String) - The url to post to.

  • postdata (String) - Post data to send to the server.

  • (Optional) callback (Function) - A callback to execute once the script has been fetched and executed. Defaults to null.

  • (Optional) errorCallback (Function) - A callback to execute if an error occurs while fetching the script. Defaults to null.

    Arguments
    • error (Error) - The error that occurred.

  • (Optional) timeout (Number) - If timeoutCallback is given, this specifies the amount of time, in milliseconds, to wait for a fetched script before dismissing it as having timed out. Defaults to GeoStream.REQUEST_TIMEOUT.

  • (Optional) preSendCallback (Function) - A callback to execute after the request has been opened, but before it is sent. Defaults to null.

    Arguments
    • request (XMLHttpRequest) - The POST request which is being sent, after .open() has been called.

whenRegistered (Function callback)

Executes a callback immediately if the GeoStream subsystem has been registered with an authentication cookie by the server and is hence ready to perform requests. Otherwise, this function queues it to be executed when registration is completed.

Arguments
  • callback (Function) - The function to be called (in arbitrary scope) once the GeoStream subsystem is ready to perform requests.

Properties
NameTypeDescription
REQUEST_TIMEOUTNumber

The amount of time, in milliseconds, to wait for a requested script to be fetched before giving up and generating a timeout error.

requestUncompressedResponsesBoolean

If true, override any HTTP headers requesting compression of the response, and tell the server to only send uncompressed responses.