Giter VIP home page Giter VIP logo

tilebelt-cs's Introduction

tilebelt

NuGet Status Build status

Set of tile utility functions written in C# for working with OpenStreetMap tiling scheme (https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames). Inspired by the Mapbox Tilebelt library (https://github.com/mapbox/tilebelt).

Install

package-install tilebelt

Dependencies

.NETStandard 2.0

Dependents

https://github.com/bertt/quantized-mesh-tile-cs

Usage

// ------------------------------------------------------
// Tilebelt methods
// ------------------------------------------------------

// Tilebelt.GetTilesOnLevel
// input: bounds [xmin, ymin, xmax, ymax] in WGS84 and z-level
// output: List of tiles in bounds and on level
var tiles = Tilebelt.GetTilesOnLevel(new double[]{-84.72,11.17,-5.62,61.60}, 10);

// Tilebelt.PointToTile
// input: x, y in WGS84
// output: tile (col, row,level)
var tile = Tilebelt.PointToTile(0, 0, 10);

// Tilebelt.QuadkeyToTile
// input: quadkey
// output: Tile (col, row, level)

// Tilebelt.GetBboxZoom
// input: bounds [xmin, ymin, xmax, ymax] in WGS84
// output: zoomlevel (int)
var level = Tilebelt.GetBboxZoom(new double[]{-84.72,11.17,-5.62,61.60});

// Tilebelt.BboxToTile
// input: bounds [xmin, ymin, xmax, ymax] in WGS84
// output: tile, smallest tile to cover the bbox
var tile = Tilebelt.BboxToTile(new double[]{-84.72,11.17,-5.62,61.60});


// ------------------------------------------------------
// Tile methods
// ------------------------------------------------------
// tile constructors
var tile = new Tile();
var tile = new Tile(5,5,10); // col, row, level

// tile.Center - get center point of tile
var center = tile.Center(); 

// tile.Bounds - get bounding box of tile
// input: -
// output: bounds [xmin, ymin, xmax, ymax] in WGS84
var bounds = tile.Bounds();

// tile.Children
// input: -
// output: 4 children tiles (col, row, level)
var tiles = tile.Children();

// tile.Parent
// input: -
// output: parent tile (col, row, level)
var parentTile = tile.Parent();

// tile.Siblings
// input: -
// out: 4 siblings tiles
var siblings = tile.Siblings();

// tile.Intersects
// input: a line (2 points) 
public bool Intersects(Point2 from, Point2 to)

// tile.Equals
// input: tile (col, row, level)
// output: boolean equals
var equals = tile1.Equals(tile2);

// tile.Quadkey()
// input: -
// output: Quadkey of tile
var quadkey = tile.Quadkey(); 

tilebelt-cs's People

Contributors

bertt avatar jtone123 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.