1.0.0 • Published 9 years ago

turf-translate v1.0.0

Weekly downloads
11
License
MIT
Repository
github
Last release
9 years ago

turf-translate

Build Status

Takes a point, linestring, polygon, or featurecollection, and translates all of its coordinates with the given translator function. The translator function is called with each coord in the argument and should return a new translated point.

###Install

npm install turf-translate

###Parameters

namedescription
fca geojson feature or featurecollection

###Usage

translate(fc, translator)

###Example

var translate = require('turf-translate')
var polygon = require('turf-polygon')

var poly = polygon([[[1,0], [1,0], [1,2]], [[.2,.2], [.3,.3],[.1,.2]]])

//move the polygon 1, 1
var translator = function(point) {
	return [point[0] + 1, point[1] + 1];
}

var translated = translate(poly, translator)

console.log(translated)