{"id":13659826,"url":"https://github.com/piruin/geok","last_synced_at":"2026-01-14T02:04:05.292Z","repository":{"id":46570154,"uuid":"121932486","full_name":"piruin/geok","owner":"piruin","description":"Kotlin geometry library","archived":false,"fork":false,"pushed_at":"2024-08-05T13:03:40.000Z","size":196,"stargazers_count":47,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T15:40:13.586Z","etag":null,"topics":["geojson","geometry","gson","java","kotlin","kotlin-multiplatform"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piruin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-18T08:19:55.000Z","updated_at":"2025-01-31T18:55:42.000Z","dependencies_parsed_at":"2024-11-10T17:40:15.033Z","dependency_job_id":null,"html_url":"https://github.com/piruin/geok","commit_stats":{"total_commits":60,"total_committers":3,"mean_commits":20.0,"dds":"0.033333333333333326","last_synced_commit":"e99f082c0974f19388a9bbc0fc0f4649ae16ba1a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/piruin/geok","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piruin%2Fgeok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piruin%2Fgeok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piruin%2Fgeok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piruin%2Fgeok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piruin","download_url":"https://codeload.github.com/piruin/geok/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piruin%2Fgeok/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geojson","geometry","gson","java","kotlin","kotlin-multiplatform"],"created_at":"2024-08-02T05:01:12.720Z","updated_at":"2026-01-14T02:04:05.276Z","avatar_url":"https://github.com/piruin.png","language":"Kotlin","funding_links":[],"categories":["Libraries"],"sub_categories":["🔧 Utils"],"readme":"# GEOK\n[![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg)](https://ktlint.github.io/)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![build](https://github.com/piruin/geok/actions/workflows/build.yml/badge.svg)](https://github.com/piruin/geok/actions/workflows/build.yml)\n[![Download](https://jitpack.io/v/piruin/geok.svg)](https://jitpack.io/#piruin/geok)\n![Maven Central](https://img.shields.io/maven-central/v/io.github.piruin/geok)\n\nSmall geometry library for Java and Kotlin. Contains useful basic utilities that require on most application. Designed\nto support data exchange between client (such as Android) and Restful api server with [GeoJSON](http://geojson.org/)\nSpec\n\n## Download\n\n\u003cdetails\u003e\n\u003csummary\u003eMavenCentral\u003c/summary\u003e\n\n```groovy\ndef geokVersion = '1.2.0' //see download badge or latest released tag\n\nrepositories {\n  mavenCentral()\n}\n\n// For multiplatform projects\nkotlin {\n  sourceSets {\n    commonMain {\n      dependencies {\n        implementation \"io.github.piruin:geok:$geokVersion\"\n      }\n    }\n  }\n}\n\ndependencies {\n  // For JVM or JS\n  implementation \"io.github.piruin:geok:$geokVersion\"\n  // For JVM only\n  implementation \"io.github.piruin:geok-gson:$geokVersion\" // for work with `gson` library\n}\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003eJitpack\u003c/summary\u003e\n\n```groovy\ndef geokVersion = '1.2.0' //see download badge or latest released tag\n\nrepositories {\n  maven { url 'https://jitpack.io' }\n}\n\n// For multiplatform projects\nkotlin {\n  sourceSets {\n    commonMain {\n      dependencies {\n        implementation \"com.github.piruin.geok:geok:$geokVersion\"\n      }\n    }\n  }\n}\n\ndependencies {\n  // For JVM or JS\n  implementation \"com.github.piruin.geok:geok:$geokVersion\"\n  // For JVM only\n  implementation \"com.github.piruin.geok:geok-gson:$geokVersion\" // for work with `gson` library\n}\n```\n\n\u003c/details\u003e\n\n## Usage\n\n### LatLng\n\nLatLng is base class of this library to build up any Geometry you want. It come with utilities such as\n\n- `toUtm()` -- convert to Utm type that widely use on GPS handheld system (also support create Latlng form Utm)\n- `distanceTo(latlng: LatLng)` -- calculate distance between 2 Latlng in meter\n\n### Geometry\n\nList of Supported Geometry type\n- `Point`\n- `LineString`\n- `Polygon`\n- `MultiPoint`\n- `MultiLineString`\n- `MultiPolygon`\n\n#### Point\n\n```kotlin\n  val point = Point(100.0 to 0.0)\n```\n- `distanceTo(latlng: Point)` -- calculate distance between 2 Point in meter\n- `insideOf(polygon: Polygon)` -- Determines whether this LatLng are inside of given Polygon.\n\n#### LineString\n\n```kotlin\n  val lineString = LineString(\n      100.0 to 0.0,\n      101.0 to 1.0\n  )\n```\nLineString come with\n- `distance` -- calculate distance of LineString in meter\n\n#### Polygon\n\n```kotlin\n    val polygon = Polygon(\n            LatLng(16.4268129901041, 102.8380009059),\n            LatLng(16.4266819930293, 102.8379568936),\n            LatLng(16.4267047695460, 102.8378494011),\n            LatLng(16.4268502721458, 102.8378330329),\n            LatLng(16.4268937418855, 102.8378020293),\n            LatLng(16.4268129901041, 102.8380009059)\n    )\n```\n\nPolygon come with utilities such as\n- `area` -- calculate area of polygon in sq.meter\n- `centroid` -- calculate centroid point of Polygon\n- `perimeter` -- calculate perimeter of Polygon's boundary in meter\n- `contains(latlng: LatLng)` -- check whether latlng is in bound of polygon\n- `intersactionWith(other: Polygon)` -- get intersection with other polygon\n\n\u003e Object creation support both LatLng styles and pair of X, Y value\n\n### BBox\n\nEvery geometry except `Point` automatically generate `BBox` on create instance.\nYou can also create your BBox's instance with\n\n```kotlin\n  val bbox = BBox.from(listOf\u003cLatLng\u003e())\n```\n\n### GeoJson\n\nAll `Geometry` of GEOK is designed to fully support GeoJSON,\nYou can easily use [Gson](https://github.com/google/gson) to serialize/deserialize them with `geok-gson` module\n\n```kotlin\n  private val gson: Gson = GsonBuilder()\n            .registerGeokTypeAdapter() // call this\n            .create()\n```\n\n#### Feature\n\nFollow GeoJSON specification, You can use `Feature` to contain extra properties along with Geometry data.\n\n```kotlin\n val feature = Feature(Polygon(\n                100.0 to 0.0,\n                101.0 to 0.0,\n                101.0 to 1.0,\n                100.0 to 1.0,\n                100.0 to 0.0), Properties())\n```\n\nAnd you may pack many `Feature` together with `FeatureCollection`\n\n## License\n\n    Copyright (c) 2018-2021 Piruin Panichphol\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n    SOFTWARE.\n\n### Notice\n\n- [Convert Between Geographic and UTM Coordinates](http://www.uwgb.edu/dutchs/UsefulData/ConvertUTMNoOZ.HTM)\n  by [Professor Steven Dutch](http://www.uwgb.edu/dutchs/index.htm)\n- [Intersection of Convex Polygons Algorithm](https://www.swtestacademy.com/intersection-convex-polygons-algorithm/)\n  by [Sinan Oz](https://www.swtestacademy.com/author/sinanoz/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiruin%2Fgeok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiruin%2Fgeok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiruin%2Fgeok/lists"}