Skip to main content
Dashboard

Return X / Y using Functional Attributes in Dashboard

POSTED: | UPDATED: | by Stefan Schüttenkopf

In this Q&A post we explain how to extract coordinates from your geometry column as a functional attribute in Dashboard

Question

We need to expose the X/Y (lat/lon) values in an attribute using Functional Attributes in the Analyzer Views configuration.
How can we accomplish this?

Answer

With JavaScript we can use the turf functional attribute to get the X/Y for each record to output to a Functional Attribute.

Functional Attribute statement to extract X:

return turf.centroid(currentRecord["geometrycolumnName"]).geometry.coordinates[0];

Functional Attribute statement to extract Y:

return turf.centroid(currentRecord["geometrycolumnName"]).geometry.coordinates[1];

After applying the functional attributes we see them show up in the Sample Feature Data depiction and the output attribute column(s) are now available for selection in Analyzer View configuration where applicable.

For more information please have a look at this tutorial as well:

How to create Functional Attributes in Dashboard
Tutorials, guides and documentation related to M.App Enterprise