Thematic Earth

GCSLIB

Parsing and Serializing GCS Strings

by Read Write Tools
Abstract
The gcslib JavaScript library is for parsing and serializing Geographic Coordinate System encoded strings and buffers. It serves as a GIS exchange format for points, lines, and polygons that use longitude/latitude coordinates.

Motivation

The creation of this library and CLI was motivated by the desire to create GIS shape files that can be downloaded by website visitors in a highly compressed format.

Summary

The gcslib package is a core JavaScript library used by the Geoplex package, the GCSIO command line tool, and the Thematic Earth web component.

Supported input and output formats comprise:

The JavaScript API reads from and writes to standard ECMAScript Strings and ArrayBuffers.

The API does not access the host computer's file system, so it can be used with client facing web pages that obtain data using HTTP.

See also: The GCSIO CLI tool which uses the node.js filesystem package to read and write files using the API's exported functions.

Installation

The gcslib library may be installed directly from github or via NPM.

Browser

To install and use the API

[user@host]# git clone https://github.com/readwritetools/gcslib.git

Sample web frontend to fetch and parse an ICE file into memory:

import API from 'node_modules/gcslib/api/user-api.js'
import GcsHoldingArea from 'node_modules/gcslib/gcs/gcs-holding-area.class.js'

var response = await fetch("https://example.com/my-dataset.ice");
var payload = await response.text();

var gcsHoldingArea = new GcsHoldingArea();
var options = {
inputFormat: "ice",
datasetId: "myDataset",
properties: "all"
};

if (API.parseIce(gcsHoldingArea, payload, options) == true) {
// gcsHoldingArea now contains the parsed features with their geometries and properties.
}

Metadata

Dependencies

This library depends on softlib.

Module exports

ES modules true
Common JS false

Suitability

Browser API
node.js API

Availability

Read Write Hub logo Documentation Read Write Hub
git logo Source code github
npm logo Package installation npm

License

The gcslib library is not freeware. After evaluating it and before using it in a public-facing website, eBook, mobile app, or desktop application, you must obtain a license from Read Write Tools as part of the thematic-earth DOM Component.

Thematic Earth Software License Agreement

Copyright © 2023 Read Write Tools.

  1. This Software License Agreement ("Agreement") is a legal contract between you and Read Write Tools ("RWT"). The "Materials" subject to this Agreement include the "Thematic Earth" software and associated documentation.
  2. By using these Materials, you agree to abide by the terms and conditions of this Agreement.
  3. The Materials are protected by United States copyright law, and international treaties on intellectual property rights. The Materials are licensed, not sold to you, and can only be used in accordance with the terms of this Agreement. RWT is and remains the owner of all titles, rights and interests in the Materials, and RWT reserves all rights not specifically granted under this Agreement.
  4. Subject to the terms of this Agreement, RWT hereby grants to you a limited, non-exclusive license to use the Materials subject to the following conditions:
    • You may not distribute, publish, sub-license, sell, rent, or lease the Materials.
    • You may not decompile or reverse engineer any source code included in the software.
    • You may not modify or extend any source code included in the software.
    • Your license to use the software is limited to the purpose for which it was originally intended, and does not include permission to extract, link to, or use parts on a separate basis.
  5. Each paid license allows use of the Materials under one "Fair Use Setting". Separate usage requires the purchase of a separate license. Fair Use Settings include, but are not limited to: eBooks, mobile apps, desktop applications and websites. The determination of a Fair Use Setting is made at the sole discretion of RWT. For example, and not by way of limitation, a Fair Use Setting may be one of these:
    • An eBook published under a single title and author.
    • A mobile app for distribution under a single app name.
    • A desktop application published under a single application name.
    • A website published under a single domain name. For this purpose, and by way of example, the domain names "alpha.example.com" and "beta.example.com" are considered to be separate websites.
    • A load-balanced collection of web servers, used to provide access to a single website under a single domain name.
  6. THE MATERIALS ARE PROVIDED BY READ WRITE TOOLS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL READ WRITE TOOLS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  7. This license is effective for a one year period from the date of purchase or until terminated by you or Read Write Tools. Continued use, publication, or distribution of the Materials after the one year period, under any of this Agreement's Fair Use Settings, is subject to the renewal of this license.
  8. Products or services that you sell to third parties, during the valid license period of this Agreement and in compliance with the Fair Use Settings provision, may continue to be used by third parties after the effective period of your license.
  9. If you decide not to renew this license, you must remove the software from any eBook, mobile app, desktop application, web page or other product or service where it is being used.
  10. Without prejudice to any other rights, RWT may terminate your right to use the Materials if you fail to comply with the terms of this Agreement. In such event, you shall uninstall and delete all copies of the Materials.
  11. This Agreement is governed by and interpreted in accordance with the laws of the State of California. If for any reason a court of competent jurisdiction finds any provision of the Agreement to be unenforceable, that provision will be enforced to the maximum extent possible to effectuate the intent of the parties and the remainder of the Agreement shall continue in full force and effect.