Skip to content

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

License

Notifications You must be signed in to change notification settings

Open-S2/gis-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gis-tools

GitHub Actions Workflow Status npm crate downloads docs-ts docs-rust code-coverage Discord

About

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

Features

Notable features of GIS-Tools are:

  • đź”— Lightweight, fast, and memory efficient. no_std builds for Rust. Tree-shaking for Typescript.
  • 🗺️ Full toolkit support for WGS84, Web Mercator, and S2 projections.
  • 🌱 A large list of projections can be converted to/from one of the above 3 via Transformers.
  • 📦 Build Vector Tiles, Raster Tiles, and Gridded Data Tiles. Vector supports 3 output formats (Mapbox Vector Tile, Open S2 Tiles, and Flat Open S2 Tiles).
  • âś… Most data structures support all projections, but primarily focus the big 3 states above. Also handle large data sets through working with the filesystem and mmap buffers.
  • đź“– Contains 23 native GIS readers. The list of readers are: CSV, GBFS, GeoTIFF, GPX, GRIB2, GTFS, JPEG and JPEG2000, (Geo|S2)JSON, LineDelimted GeoJSON, GeoJSON Text Sequences, LAS, LAZ, NadGrids, NetCDF, OSM, (S2)PMTiles, Shapefiles, raster and vector tiles, WKT, and XML.
  • 🦺 Secure code where the only external dependency is sharp for local image processing, otherwise all code is written internally by Open S2 in Typescript or Rust.
  • 🧲 Full suite of tools for points, lines, polygons, greater-circle-arcs, predicates, and more.
  • 🌌 Space specific tools for planets and satellite orbits.

Goals

Making GIS data easy to parse and work with. One of the biggest issues in GIS right now is how segmented various niche tools are. The other issue is how most solutions to read GIS data are half baked, deprecated, or partially parse results that need to be transformed one more time to use them.

So this tool exists to make GIS tools simple to use, various data fast to parse, and transformed to usable projections without having to worry about the details.

Lastly the goal is for all code to be accessible to both the browser and locally. An example was the shapefile reader where it can pull from online data or handle extremely large data as well.

Install

# NPM
npm install gis-tools-ts
# PNPM
pnpm add gis-tools-ts
# Yarn
yarn add gis-tools-ts
# Bun
bun add gis-tools-ts
# Deno
deno install gis-tools-ts

# Cargo
cargo add gis-tools

Components

đź’ˇ NOTE: The sizes are estimates and can change based on how you use them. Click the module link for documentation and more precise guides on file cost.

Converters

Module Size Description
toJSON To JSON Badge Convert any Reader to JSON data.
toTiles FT Badge Convert any Reader to vector and/or raster tiles.

Data Stores

Module Size Description
externalSort ES Badge Sort large files with uint64 keys
kv KV Badge Key-Value store that works in the browser and the filesystem.
multiMap MM Badge Multi-map that works in the browser and the filesystem.
vector Vec Badge Vector store that works in the browser and the filesystem.

Data Structures

Module Size Description
cache Cache Badge A KV cache for values with a max size. Least used dropped first.
pointGrid PG Badge Point grid tiling for number or raster data.
pointCluster PC Badge Point cluster tool with indexing.
pointIndex PI Badge Point indexing with range/radius queries.
pointIndexFast PIF Badge Faster point indexing with range/radius queries.
priorityQueue PQ Badge A priority queue.
tile Tile Badge A tile/layer management tool for features.

Geometry

Module Size Description
angles Angle Badge Spherical geodetic angle methods.
bbox BBOX Badge Bounding box creation/manipulation.
id ID Badge ID tools for S2 and WM.
lonlat LonLat Badge Longitude/Latitude convienience methods.
predicates Pred Badge Reliability predicates for 2D and 3D orientation geometry.
s2 S2 Badge S2 geometry convienience methods.
tools Tools Badge Geometry manipulation tools.
wm WM Badge Web Mercator (WM) geometry convienience methods.

PROJ4

Module Size Description
mgrs MGRS Badge Military Grid Reference System (MGRS) converter.
projections Proj Badge Supports a large list of projections to be used by transformers.
transformer Trans Badge Tool for transforming coordinates from one projection to another.

Readers

Most readers are parsers that take ReaderInputs as an input. This is to ensure both browser and file inputs are supported. You can learn more about readers here.

Module Size Description
jpeg JPEG Badge Read/parse JPEG data.
jpeg2000 JPEG2 Badge Read/parse JPEG 2000 data.
lanczos Lanc Badge Apply a Lanczos filter that downsamples an image.
csv CSV Badge CSV data reader with options on parsing.
gbfs GBFS Badge General Bikeshare Feed Specification reader.
geotiff GTiff Badge Geotiff image reader with projection support.
gpx GPX Badge GPX (xml based) data reader.
grib2 grib2 Badge GRIB 2 data reader.
gtfs gtfs Badge General Transit Feed Specification. Both Static and Realtime.
json JSON Badge JSON data reader with line delimiter support.
las LAS Badge LAS data reader.
laz LAZ Badge LASzipped data reader.
nadgrid NGrid Badge NAD Grid data reader.
netcdf NetCDF Badge NetCDF data reader.
osm OSM Badge OpenStreetMap PBF data reader
pmtiles PMT Badge (S2)PMTiles data reader.
protobuf Proto Badge Protobuf data reader/writer.
shapefile Shape Badge Shapefile data reader supporting DBF and projections (PRJ).
tileReader TR Badge Tile data reader, usually from a local input folder.
wkt wkt Badge Well Known Text data reader.
xml XML Badge XML data reader.

Space

Module Size Description
planets Planet Badge Collection of planet constants with observation tools.
satellite SAT Badge Satellite Orbit Class from TLE data

Tools

Module Size Description
delaunator DEL Badge Delaunay triangulation of 2D points.
interpolators INT Badge Interpolate values from points and weights.
orthodrome ORT Badge Find shortest path between two points or point on path.
polylabel POL Badge Find the labels for vector polygons

Writers

Module Size Description
pmtilesWriter PMTW Badge Write (S2)PMTiles data.
tileWriter TW Badge Write (S2)Tiles data. Supports time series as well.

Utils

Module Size Description
polyfills PF Badge Collection of polyfills that might add value for the browser.
compression CMP Badge compression/decompression convenience methods.

Development

Requirements

You need the tool tarpaulin to generate the coverage report. Install it using the following command:

cargo install cargo-tarpaulin

The bacon coverage tool is used to generate the coverage report. To utilize the pycobertura package for a prettier coverage report, install it using the following command:

pip install pycobertura

Running Tests

To run the tests, use the following command:

# TYPESCRIPT
## basic test
bun run test
## live testing
bun run test:dev

# RUST
## basic test
cargo test
# live testing
bacon test

Generating Coverage Report

To generate the coverage report, use the following command:

# install
cargo +stable install cargo-llvm-cov --locked
# run test
cargo llvm-cov
# bacon
bacon coverage # or type `l` inside the tool

# output lcov
cargo llvm-cov --lcov --output-path coverage/lcov.info

Using Tokei

cargo install tokei

About

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages