2017-09-01 09:58:36 -07:00
|
|
|
import turfHelpers from '@turf/helpers';
|
|
|
|
|
|
2017-10-05 16:41:35 -07:00
|
|
|
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:41:35 -07:00
|
|
|
|
2017-10-05 16:44:32 -07:00
|
|
|
export function makeFeature (geometry, properties) {
|
2017-10-05 16:41:35 -07:00
|
|
|
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);
|
2017-10-05 16:41:35 -07:00
|
|
|
return featureCollection;
|
|
|
|
|
}
|