Files

27 lines
811 B
JavaScript
Raw Permalink Normal View History

2017-09-01 09:58:36 -07:00
import turfHelpers from '@turf/helpers';
export function makePoint (coordinates, properties) {
return turfHelpers.point(coordinates, properties);
2017-09-01 09:58:36 -07:00
}
export function makeLatLngBounds (northEastCoordinates, southWestCoordinates) {
return turfHelpers.featureCollection([
turfHelpers.point(northEastCoordinates),
turfHelpers.point(southWestCoordinates),
]);
}
2017-10-05 16:44:32 -07:00
export function makeFeature (geometry, properties) {
return turfHelpers.feature(geometry, properties);
}
export function makeFeatureCollection (features = []) {
return turfHelpers.featureCollection(features);
}
export function addToFeatureCollection (featureCollection, feature) {
let shallowFeatureCollection = Object.assign({}, featureCollection);
2017-10-05 16:44:32 -07:00
shallowFeatureCollection.features.push(feature);
return featureCollection;
}