3.0.12 • Published 8 years ago
turf-tag v3.0.12
turf-tag
turf tag module
turf.tag(points, polygons, polyId, containingPolyId)
Takes a FeatureCollection of Point features and a FeatureCollection of Polygon features and performs a spatial join.
Parameters
parameter | type | description |
---|---|---|
points | FeatureCollection | a FeatureCollection of Point features |
polygons | FeatureCollection | a FeatureCollection of Polygon features |
polyId | String | property in polygons to add to joined Point features |
containingPolyId | String | property in points in which to store joined property from `polygons |
Example
var bbox = [0, 0, 50, 50];
// create a triangular grid of polygons
var triangleGrid = turf.tin(turf.grid(bbox, 10));
triangleGrid.features.forEach(function(f) {
f.properties.fill = '#' +
(~~(Math.random() * 16)).toString(16) +
(~~(Math.random() * 16)).toString(16) +
(~~(Math.random() * 16)).toString(16);
f.properties.stroke = 0;
f.properties['fill-opacity'] = 1;
});
var randomPoints = turf.random('point', 30, {
bbox: bbox
});
var both = turf.featurecollection(
triangleGrid.features.concat(randomPoints.features));
//=both
var tagged = turf.tag(randomPoints, triangleGrid,
'fill', 'marker-color');
//=tagged
Installation
Requires nodejs.
$ npm install turf-tag
Tests
$ npm test
3.0.12
8 years ago
3.0.10
8 years ago
3.0.7-canary.ae89c8b3
8 years ago
3.0.5
8 years ago
3.0.1
8 years ago
3.0.0-canary.7879bf6c
8 years ago
3.0.0-canary.2f5f7167
8 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago