JavaScript Orthographic Earth

GCS I/O

Geographic Coordinate System Formats

by Read Write Tools
Abstract
The gcsio JavaScript library and CLI tool is for reading, parsing, serializing, and writing Geographic Coordinate System file encodings. 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 gcsio package is both a command line utility and a JavaScript API. This library is used by the Geoplex package and the JavaScript Orthographic Earth web component rwt-orthographic-earth.

Supported input and output formats comprise:

  • geojson - RFC 7946
  • gfe - Geographic Feature Encoding
  • ice - Indexed Coordinate Encoding
  • tae - Topological Arc Encoding
  • gfebin - Geographic Feature Encoding binary
  • icebin - Indexed Coordinate Encoding binary
  • taebin - Topological Arc Encoding binary

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.

The CLI uses the node.js filesystem package to read and write files using the API's exported functions.

Installation

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

Node.js

To install and run the CLI:

[user@host]# npm install -g gcsio

[user@host]# gcsio --help

GCSCIO | Geographic Coordinate System I/O: reading from and writing to files with longitude/latitude coordinates
usage: gcscio --input=filename --output=filename [options]

options:
--input= filename to read from
--output= filename to write to
--iformat= input file format, optionally defaults to filename extension
--oformat= output file format, optionally defaults to filename extension
'geojson' RFC 7946
'gfe' Geographic Feature Encoding
'gfebin' Geographic Feature Encoding binary
'ice' Indexed Coordinate Encoding
'icebin' Indexed Coordinate Encoding binary
'tae' Topological Arc Encoding
'taebin' Topological Arc Encoding binary
--accuracy= digits to use for latitude and longitude coordinates 1 to 6 (1=11km, 2=1100m, 3=110m, 4=11m, 5=1.1m, 6=11cm)
--dataset-id= identifier for the collection of points, lines or polygons
--properties which properties to include with each feature
a comma-separated list of property names, or the keyword 'none' or 'all'†
--declarations the name of a file which contains declarations of property names and property types
where each line is in the form "name=type"
Valid types are:
string, string[],
tinyInt, tinyUint, tinyInt[], tinyUint[]
shortInt, shortUint, shortInt[], shortUint[]
longInt, longUint, longInt[], longUint[]
float, float[]
json
--version
--help

† default

Browser

To install and use the API

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

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

import API from 'node_modules/gcsio/api/user-api.js'
import GcsHoldingArea from 'node_modules/gcsio/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 iolib and softlib.

Module exports

ES modules true
Common JS false

Suitability

Browser API
node.js CLI and API

Availability

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

License

The gcsio 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 rwt-orthographic-earth DOM Component.

JavaScript Orthographic Earth Software License Agreement

Copyright © 2022 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 "JavaScript Orthographic 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.

GCS I/O — Geographic Coordinate System Formats

🔗 🔎