{"id":32166008,"url":"https://github.com/jongretar/geoturf","last_synced_at":"2026-04-26T18:02:53.686Z","repository":{"id":62429838,"uuid":"184035777","full_name":"JonGretar/GeoTurf","owner":"JonGretar","description":"A spatial analysis tool for Elixir ported from turfjs.org","archived":false,"fork":false,"pushed_at":"2025-08-19T10:43:35.000Z","size":92,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T15:03:01.023Z","etag":null,"topics":["elixir","elixir-lang","geolocation","geospatial","spatial-analysis"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/geo_turf","language":"Elixir","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/JonGretar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2019-04-29T08:56:25.000Z","updated_at":"2025-08-19T10:42:34.000Z","dependencies_parsed_at":"2023-09-25T01:52:08.245Z","dependency_job_id":"300c706a-f20e-44e0-a032-d1e6a1aca29a","html_url":"https://github.com/JonGretar/GeoTurf","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"7247c1aa2385a4a6baf9fa738eaf4470c3f6a344"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/JonGretar/GeoTurf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonGretar%2FGeoTurf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonGretar%2FGeoTurf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonGretar%2FGeoTurf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonGretar%2FGeoTurf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonGretar","download_url":"https://codeload.github.com/JonGretar/GeoTurf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonGretar%2FGeoTurf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29605802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["elixir","elixir-lang","geolocation","geospatial","spatial-analysis"],"created_at":"2025-10-21T15:01:51.646Z","updated_at":"2026-04-26T18:02:53.680Z","avatar_url":"https://github.com/JonGretar.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geo.Turf\n\n[![CI](https://github.com/JonGretar/GeoTurf/actions/workflows/ci.yml/badge.svg)](https://github.com/JonGretar/GeoTurf/actions/workflows/ci.yml)\n[![hex.pm](https://img.shields.io/hexpm/v/geo_turf.svg)](https://hex.pm/packages/geo_turf)\n\nSpatial analysis for Elixir, ported from [TurfJS](http://turfjs.org/). Operates on [Geo](https://github.com/bryanjos/geo) structs using WGS84 coordinates.\n\n## Usage\n\nAll functions accept and return standard `Geo` structs.\n\n### `Geo.Turf.Measure`\n\nMeasurements and geometry queries.\n\n```elixir\npoint = %Geo.Point{coordinates: {-75.343, 39.984}}\nother = %Geo.Point{coordinates: {-75.534, 39.123}}\n\nGeo.Turf.Measure.distance(point, other, :kilometers)       # =\u003e 97.13\nGeo.Turf.Measure.bearing(point, other)                     # =\u003e -170.23\nGeo.Turf.Measure.close_to(point, other, 100, :kilometers)  # =\u003e true\nGeo.Turf.Measure.destination(point, 50, 90, units: :kilometers)  # =\u003e %Geo.Point{...}\n\nroute = %Geo.LineString{coordinates: [{-23.621, 64.769}, {-23.629, 64.766}, {-23.638, 64.766}]}\nGeo.Turf.Measure.length_of(route, :kilometers)   # =\u003e 0.93\nGeo.Turf.Measure.along(route, 0.5, :kilometers)  # =\u003e %Geo.Point{...}\n\npolygon = %Geo.Polygon{coordinates: [[{125, -15}, {113, -22}, {154, -27}, {144, -15}, {125, -15}]]}\nGeo.Turf.Measure.area(polygon)      # =\u003e 3332484969239.27 (m²)\nGeo.Turf.Measure.center(polygon)    # =\u003e %Geo.Point{...}  (bbox centre)\nGeo.Turf.Measure.centroid(polygon)  # =\u003e %Geo.Point{...}  (mean of vertices)\n```\n\n### `Geo.Turf.Classification`\n\nSpatial predicates and search.\n\n```elixir\npoly = %Geo.Polygon{coordinates: [[{0, 0}, {0, 10}, {10, 10}, {10, 0}, {0, 0}]]}\n\nGeo.Turf.Classification.point_in_polygon?(%Geo.Point{coordinates: {5, 5}}, poly)   # =\u003e true\nGeo.Turf.Classification.point_in_polygon?(%Geo.Point{coordinates: {15, 5}}, poly)  # =\u003e false\n\npoints = [%Geo.Point{coordinates: {5, 5}}, %Geo.Point{coordinates: {15, 5}}]\nGeo.Turf.Classification.points_within_polygon(points, poly)  # =\u003e [%Geo.Point{coordinates: {5, 5}}]\n\ntarget = %Geo.Point{coordinates: {0, 0}}\nGeo.Turf.Classification.nearest_point(target, points)  # =\u003e %Geo.Point{coordinates: {5, 5}}\n```\n\n### `Geo.Turf.Transformation`\n\nGeometry construction and transformation.\n\n```elixir\npoint = %Geo.Point{coordinates: {-75.343, 39.984}}\n\nGeo.Turf.Transformation.circle(point, 10, units: :kilometers)  # =\u003e %Geo.Polygon{...}\n```\n\n### `Geo.Turf.Helpers`\n\nBounding box utilities.\n\n```elixir\npolygon = %Geo.Polygon{coordinates: [[{0, 0}, {0, 10}, {10, 10}, {10, 0}, {0, 0}]]}\n\nGeo.Turf.Helpers.bbox(polygon)             # =\u003e {0, 0, 10, 10}\nGeo.Turf.Helpers.bbox_polygon({0, 0, 10, 10})  # =\u003e %Geo.Polygon{...}\n\n# Compose them:\npolygon |\u003e Geo.Turf.Helpers.bbox() |\u003e Geo.Turf.Helpers.bbox_polygon()  # =\u003e %Geo.Polygon{...}\n```\n\nSee the [full API docs](https://hexdocs.pm/geo_turf) for all available functions.\n\n## Works with geo_postgis\n\nIf you query a PostGIS database via [`geo_postgis`](https://github.com/felt/geo_postgis), the structs it returns work directly with GeoTurf — no conversion needed:\n\n```elixir\n# Ecto query returns %Geo.Point{} and %Geo.Polygon{} fields automatically.\n# Pass them straight into GeoTurf:\nlocations\n|\u003e Enum.filter(\u0026Geo.Turf.Measure.close_to(\u00261.geom, origin, 50, :kilometers))\n|\u003e Enum.sort_by(\u0026Geo.Turf.Measure.distance(\u00261.geom, origin))\n```\n\n## Suggestions\n\nMissing a function from [TurfJS](http://turfjs.org/)? Open an issue — a test case alongside it is always welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongretar%2Fgeoturf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongretar%2Fgeoturf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongretar%2Fgeoturf/lists"}