Skip to content

cortwave/geogrid

Repository files navigation

geogrid

Build Status

Library for creating hex grid on sphere

Setup

Gradle (Jitpack dependency)

repositories {
    ...
    maven { url "https://jitpack.io" }
}

compile 'com.github.cortwave:geogrid:0.1.0'

Quick start

int detalizationLevel = 12;
Grid<Hex> grid = new HexGrid(detalizationLevel);
double latitude = -35.44;
double longitude = 22.34;
GeoPoint point = new GeoPoint(latitude, longitude);
Hex hex = grid.getZoneAt(point);
List<GeoPoint> polygon = hex.getPolygon();
String zoneId = hex.getId();

Hex side and area

Hex side

hex side

where b - hex side, d - detalization level, C - Earth meridional circumference (40 007.86 km)

Hex area

hex square

where Sb - hex area, d - detalization level, Se - Earth surface area (510072000 km^2)

Examples of work

Detalization level 5

detalization level 5

Detalization level 16 (Manhattan)

detalization level 16

Detalization level 7 (Australia)

detalization level 17

About

Library for creating hex grid over the Earth

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages