Skip to content

tomchavakis/turf-go

Repository files navigation

🔨 release GoDoc GitHub license Go Report Card Coverage Status

turf-go

A Go language port of Turfjs

Turf for Go

Turf for Go is a ported library in GoLang ported from the Turf.js library.

Extra modules

This version also include the clustering module that doesn't exist in the official turf library.

Ported functions

measurement

  • along
  • area
  • bbox
  • bboxPolygon
  • bearing
  • center
  • centerOfMass
  • centroid
  • destination
  • distance
  • envelope
  • length
  • midpoint
  • pointOnFeature
  • polygonTangents
  • pointToLineDistance
  • rhumbBearing
  • rhumbDestination
  • rhumbDistance
  • square
  • greatCircle

clustering

  • kmeans

Coordinate Mutation

  • cleanCoords
  • flip
  • rewind
  • round
  • truncate

Transformation

  • bboxClip
  • bezierSpline
  • buffer
  • circle
  • clone
  • concave
  • convex
  • difference
  • dissolve
  • intersect
  • lineOffset
  • simplify
  • tesselate
  • transformRotate
  • transformTranslate
  • transformScale
  • union
  • voronoi

Feature Conversion

  • combine
  • explode
  • flatten
  • lineToPolygon
  • polygonize
  • polygonToLine

Misc

  • kinks
  • lineArc
  • lineChunk
  • lineIntersect
  • lineOverlap
  • lineSegment
  • lineSlice
  • lineSliceAlong
  • lineSplit
  • mask
  • nearestPointOnLine
  • sector
  • shortestPath
  • unkinkPolygon

Helper

  • featureCollection
  • feature
  • geometryCollection
  • lineString
  • multiLineString
  • multiPoint
  • multiPolygon
  • point
  • polygon

Random

  • randomPosition
  • randomPoint
  • randomLineString
  • randomPolygon

Data

  • sample

Joins

  • pointsWithinPolygon
  • tag

Grids

  • hexGrid
  • pointGrid
  • squareGrid
  • triangleGrid

Classification

  • nearestPoint

Aggregation

  • collect
  • clustersDbscan
  • clustersKmeans

Meta - Invariant

  • coordAll
  • coordEach
  • coordReduce
  • featureEach
  • featureReduce
  • flattenEach
  • flattenReduce
  • getCoord
  • getCoords
  • getGeom
  • getType
  • geomEach
  • geomReduce
  • propEach
  • propReduce
  • segmentEach
  • segmentReduce
  • getCluster
  • clusterEach
  • clusterReduce

Assertions

  • collectionOf
  • containsNumber
  • geojsonType
  • featureOf

Booleans

  • booleanClockwise
  • booleanContains
  • booleanCrosses
  • booleanDisjoint
  • booleanEqual
  • booleanOverlap
  • booleanParallel
  • booleanPointInPolygon
  • booleanPointOnLine
  • booleanWithin

Unit Conversion

  • bearingToAzimuth
  • convertArea
  • convertLength
  • degreesToRadians
  • lengthToRadians
  • lengthToDegrees
  • radiansToLength
  • radiansToDegrees
  • toMercator
  • toWgs84

References:

https://github.com/mapbox/mapbox-java

https://github.com/Turfjs/turf