allows you to run turf functions on streaming line delimited json
use --method
astro --method=bboxPolygon
accepted method names are any turf module
If you want to call a method that requires other parameters, for example, buffer,
use --args
. $
is a standin for the streaming line input. Note that the value of --args
must be quoted if it contains strings or objects.
cat polygons.json | astro --method=buffer --args='$,10,"miles"'
If the input contains feature collections, they can be split so that each feature is processed separately using --splitCollections
. This is useful when piping the input from another task that outputs feature collections (like turf-random does)
echo '[-122.8,37.2,-121.7,37.9]' | \
astro --method=random --args='"point",1000,{"bbox":$}' | \
astro --splitCollections --method=buffer --args='$,100,"miles"'
Processing can be done in parallel, using one worker per CPU core via the -P
flag. Unless you are doing especially heavy operations (such as complex unions, large merges, etc) this is not advised, because the cost of sending messages between processes usually outweighs the benefit of processing in parallel.