All Projects → piruin → geok

piruin / geok

Licence: MIT license
Kotlin geometry library

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to geok

geofeatures2
A lightweight, high performance geometry library in Swift.
Stars: ✭ 18 (-37.93%)
Mutual labels:  geojson, geometry
geojson-bbox
Calculates extent/bbox for a given valid geojson object.
Stars: ✭ 25 (-13.79%)
Mutual labels:  geojson, geometry
GeoJSON4EntityFramework
Create GeoJSON from Entity Framework Spatial Data or WKT
Stars: ✭ 18 (-37.93%)
Mutual labels:  geojson, geometry
Indonesia Postal And Area
Indonesia Postal Code & Area (BPS)
Stars: ✭ 64 (+120.69%)
Mutual labels:  geojson, geometry
geoh
Transform a geoJSON into a list of geohashes that intersect with it
Stars: ✭ 26 (-10.34%)
Mutual labels:  geojson, geometry
osm-static-maps
Openstreetmap static maps is a nodejs lib, CLI and server open source inspired on google static map service
Stars: ✭ 130 (+348.28%)
Mutual labels:  geojson, geometry
paramak
Create parametric 3D fusion reactor CAD and neutronics models
Stars: ✭ 40 (+37.93%)
Mutual labels:  geometry
chords
A Kotlin multi-platform view library for displaying stringed instrument chord diagrams
Stars: ✭ 25 (-13.79%)
Mutual labels:  kotlin-multiplatform
MultiplatformPlayground
Kotlin Multiplatform project in Jetpack Compose & SwiftUI with shared ViewModel layer and File upload
Stars: ✭ 72 (+148.28%)
Mutual labels:  kotlin-multiplatform
CompleteKotlin
Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms.
Stars: ✭ 236 (+713.79%)
Mutual labels:  kotlin-multiplatform
kiwi
Fluent assertions for Kotlin
Stars: ✭ 17 (-41.38%)
Mutual labels:  kotlin-multiplatform
fx-gson
A set of type adapters for Google Gson to make JavaFX properties serialization more natural
Stars: ✭ 53 (+82.76%)
Mutual labels:  gson
geoJSON-Nepal
GeoJSON for Nepal. 🇳🇵
Stars: ✭ 49 (+68.97%)
Mutual labels:  geojson
Geometry-Solving
This is an open source project to share algorithms for solving the geometry games Pythagorea, Pythagorea 60, Euclidea 3 and Xsection
Stars: ✭ 17 (-41.38%)
Mutual labels:  geometry
geopip
Reverse geocode a lng/lat coordinate within a geojson `FeatureCollection` and return information about the containing country (polygon).
Stars: ✭ 27 (-6.9%)
Mutual labels:  geojson
kotlin-no-backend
Lista de empresas que utilizam Kotlin no Brasil.
Stars: ✭ 46 (+58.62%)
Mutual labels:  kotlin-multiplatform
geojson-rbush
GeoJSON implementation of RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles
Stars: ✭ 60 (+106.9%)
Mutual labels:  geojson
oriedita
Oriedita (fork of Orihime) is an origami crease pattern editor and folding simulator.
Stars: ✭ 28 (-3.45%)
Mutual labels:  geometry
wkb-parser
Well-known binary (WKB) Parser.
Stars: ✭ 69 (+137.93%)
Mutual labels:  geometry
HTTP-Wrapper
A simple http wrapper
Stars: ✭ 13 (-55.17%)
Mutual labels:  gson

GEOK

ktlint pre-commit build Download Maven Central

Small geometry library for Java and Kotlin. Contains useful basic utilities that require on most application. Designed to support data exchange between client (such as Android) and Restful api server with GeoJSON Spec

Download

MavenCentral
def geokVersion = '1.2.0' //see download badge or latest released tag

repositories {
  mavenCentral()
}

// For multiplatform projects
kotlin {
  sourceSets {
    commonMain {
      dependencies {
        implementation "io.github.piruin:geok:$geokVersion"
      }
    }
  }
}

dependencies {
  // For JVM or JS
  implementation "io.github.piruin:geok:$geokVersion"
  // For JVM only
  implementation "io.github.piruin:geok-gson:$geokVersion" // for work with `gson` library
}
Jitpack
def geokVersion = '1.2.0' //see download badge or latest released tag

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

// For multiplatform projects
kotlin {
  sourceSets {
    commonMain {
      dependencies {
        implementation "com.github.piruin.geok:geok:$geokVersion"
      }
    }
  }
}

dependencies {
  // For JVM or JS
  implementation "com.github.piruin.geok:geok:$geokVersion"
  // For JVM only
  implementation "com.github.piruin.geok:geok-gson:$geokVersion" // for work with `gson` library
}

Usage

LatLng

LatLng is base class of this library to build up any Geometry you want. It come with utilities such as

  • toUtm() -- convert to Utm type that widely use on GPS handheld system (also support create Latlng form Utm)
  • distanceTo(latlng: LatLng) -- calculate distance between 2 Latlng in meter

Geometry

List of Supported Geometry type

  • Point
  • LineString
  • Polygon
  • MultiPoint
  • MultiLineString
  • MultiPolygon

Point

  val point = Point(100.0 to 0.0)
  • distanceTo(latlng: Point) -- calculate distance between 2 Point in meter
  • insideOf(polygon: Polygon) -- Determines whether this LatLng are inside of given Polygon.

LineString

  val lineString = LineString(
      100.0 to 0.0,
      101.0 to 1.0
  )

LineString come with

  • distance -- calculate distance of LineString in meter

Polygon

    val polygon = Polygon(
            LatLng(16.4268129901041, 102.8380009059),
            LatLng(16.4266819930293, 102.8379568936),
            LatLng(16.4267047695460, 102.8378494011),
            LatLng(16.4268502721458, 102.8378330329),
            LatLng(16.4268937418855, 102.8378020293),
            LatLng(16.4268129901041, 102.8380009059)
    )

Polygon come with utilities such as

  • area -- calculate area of polygon in sq.meter
  • centroid -- calculate centroid point of Polygon
  • perimeter -- calculate perimeter of Polygon's boundary in meter
  • contains(latlng: LatLng) -- check whether latlng is in bound of polygon
  • intersactionWith(other: Polygon) -- get intersection with other polygon

Object creation support both LatLng styles and pair of X, Y value

BBox

Every geometry except Point automatically generate BBox on create instance. You can also create your BBox's instance with

  val bbox = BBox.from(listOf<LatLng>())

GeoJson

All Geometry of GEOK is designed to fully support GeoJSON, You can easily use Gson to serialize/deserialize them with geok-gson module

  private val gson: Gson = GsonBuilder()
            .registerGeokTypeAdapter() // call this
            .create()

Feature

Follow GeoJSON specification, You can use Feature to contain extra properties along with Geometry data.

 val feature = Feature(Polygon(
                100.0 to 0.0,
                101.0 to 0.0,
                101.0 to 1.0,
                100.0 to 1.0,
                100.0 to 0.0), Properties())

And you may pack many Feature together with FeatureCollection

License

Copyright (c) 2018-2021 Piruin Panichphol

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Notice

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].