Skip to content

ScriptHound/dotentile

Repository files navigation

Dotentile

Dotentile is GDAL-based library to convert lat long data into XYZ tiles and vice versa.

Inspired by mercantile

Installation

dotnet add package ScriptHound.Dotentile

Examples

Converting lat lot with predefined zoom level to XYZ tiles

using Dotentile;

var lon = 39.344371f;
var lat = 72.878013f;
var zoom = 14;

var xyz = Translation.XYZFromLatLon(lat, lon, zoom);
var expected = new List<int> { 11508, 6241, 14 };

Converting XYZ tiles to lat long

var x = 11508;
var y = 6241;
var z = 14;

var latLon = Translation.LatLonFromXYZ(x, y, z);
var expected = new List<float> { 72.878013f, 39.344371f };

Getting all XYZ tiles which intersect Geojson polygon

var geoJson = "{\"type\": \"Polygon\", \"coordinates\": [[[-180, 85], [180, 85], [180, -85], [-180, -85], [-180, 85]]]}";
var zoom = 14;
var tiles = Translation.TilesFromGeojson(geoJson, zoom);

About

Dotnet XYZ tile library inspired by Mercantile

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages