Socket
Socket
Sign inDemoInstall

open-geotiling

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    open-geotiling

OpenGeoTiling


Version published
Weekly downloads
1
Maintainers
1
Install size
321 kB
Created
Weekly downloads
 

Readme

Source

open-geotiling-typescript

Open GeoTiling typescript implementation.

The original library can be found here : https://github.com/bocops/open-geotiling

How to get it ?

npm install open-geotiling --save

Usage

Get approximative direction between OLC

const tile1 = OpenGeoTile.buildFromTileAddress("9F53");
const tile2 = OpenGeoTile.buildFromTileAddress("8FX3");
tile1.getDirection(tile2); // ~= Math.PI / 2

Test adjacency

const originalBlock = OpenGeoTile.buildFromTileAddress("8CRW2X");
[
  OpenGeoTile.buildFromTileAddress("8CRW3W"),
  OpenGeoTile.buildFromTileAddress("8CRW3X")
].forEach(other => {
  if (originalBlock.isNeighbor(other{
    // do something.
  }
});

Membership (contains)

const bigBlock = OpenGeoTile.buildFromTileAddress("8CFF");
const smallBlock = OpenGeoTile.buildFromTileAddress("8CFFXX");
const tinyBlock = OpenGeoTile.buildFromTileAddress("8CFFXXHH");

bigBlock.contains(smallBlock); // true
bigBlock.contains(tinyBlock); // true

Get all GeoTiles for a polygon made of coordinates

const coords = [];
coords.push(new Coordinate(47.475062, -0.552563));
coords.push(new Coordinate(47.469938, -0.552563));
coords.push(new Coordinate(47.469938, -0.547438));
coords.push(new Coordinate(47.475062, -0.547438));

const testTileArea = new TileAreaPolygonalBuilder()
      .setPrecision(TileSize.PINPOINT) // find all tiles for this size
      .setMaximumTileSize(TileSize.NEIGHBORHOOD) // merge tiles to this maximum size (default is setPrecision value)
      .setCoordinatesList(coords)
      .build();

Licence

The project is licensed under the Apache License 2.0.

FAQs

Last updated on 28 Nov 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc