This n8n workflow automates the process of calculating the centroid of a set of vectors received through a webhook. Ideal for data analysis, machine learning, or geographic computations, it accepts a GET request containing an array of vectors. The workflow then extracts and validates these vectors, ensuring all have the same dimensions. It computes the centroid by averaging each dimension across all vectors and finally responds with the calculated centroid or an error message if the input is invalid.
The process begins with a webhook trigger, which listens for requests with vector data. The vectors are then extracted and formatted. Next, a code node validates the vectors’ structure and calculates the centroid by averaging each element. The results are sent back to the requester, enabling real-time, automated centroid calculations for various applications such as spatial data analysis, clustering, or machine learning preprocessing.
Reviews
There are no reviews yet.