Mapbox Data Format

I'm having trouble getting data from a query to display as points in the Mapbox visualisation.

Currently my query returns one column for longitude, and one for latitude as shown below:

image

However, when I go to put this into the visual, and format the data from the query as an array - no points from my query pull through:

image

How should I format the points formula to correctly pull in values from my underlying query?

As an aside, how do I get the default lat and long co-ordinates to just use of the values from my query (one of the results I return in the table is called 'Club', and has lat and long coordinates - I would like the default to use that, can I filter the table to only return the results for that one row?).

And secondly for the GeoJSON, I don't want this to show - how can I disable it?

Thank you!

Hi @mitchscales Thanks for reaching out!

Is InstructorDensity the name of your lat/long query? If so, the data will be stored under the .data property, so InstructorDensity.data. Then, you'll need to determine if your .data is structured as an array of objects or an object of arrays.

If it's coming from SQL, it's likely an object of arrays. In that case, you could return InstructorDensity.data.latitude and InstructorDensity.data.longitude to get two arrays of values. That said, the points section is actually looking for a single array with an object for each lat/long, so you'll have to use some Javascript to format your data in that structure. This post may help!

I believe you can leave the GeoJSON as empty & the map will still work as expected, despite the red outline

For table filtering, we have this doc, or you could use a transformer on your table query & use Javascript code to filter the data.