Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript
https://turfjs.org/
MIT License
9.26k stars 937 forks source link

Add `bbox` parameter to @turf/interpolate #1031

Open stebogit opened 6 years ago

stebogit commented 6 years ago

Currently @turf/interpolate defines the area on which to interpolate the values as the bounding box surrounding the input points. It would be useful to be able to define your area of interest, which might be different than the current (then default)bbox(points), like this:

screen shot 2017-10-19 at 8 11 05 am

or this: screen shot 2017-10-19 at 8 19 22 am

DenisCarriere commented 6 years ago

We can pass the same options from the grid modules, I've added mask for each of them, that might work?

stebogit commented 6 years ago

Yep, mask would definitely work 👍

Now that I look at it we should also rename cellSize to cellSide as we did in the grid modules

Also, I was wondering why was clone introduced in here

var newFeature = clone(gridFeature);
newFeature.properties[property] = zw / sw;
results.push(newFeature);
...
return featureCollection(results);
DenisCarriere commented 6 years ago

Clone was used because it mutates the properties, I'm sure there might be a way to remove the clone.

newFeature.properties[property] = zw / sw;
DenisCarriere commented 6 years ago
romick101 commented 2 years ago

Hello, is there any progress with mask parameter? Maybe I'm overlooking some other way to achieve custom interpolation boundary?

iamtekson commented 4 months ago

Is the mask parameter already implemented? I haven't seen that parameter in documentation.

EDIT: Even though the mask parameter is not mentioned in the documentation, it is there and working properly. But mask option doesn't seem like an option. For example, in below image, I am trying to interpolate 4 points within the polygon (pink background) but I got the values only for the bbox of the input points not for the whole polygon.

image