MapBox component reading Lat/Long from table compnent

Hi
I am a new user of Retool. I built an app with a table component and a MapBox component. The table component has longitude and latitude columns.

How can I show points on the MapBox component where the points are built using the table's longitude and latitude columns?
Thank you.

Hi @Aussie Welcome to Retool! :sunglasses:

The mapbox component is expecting an array of objects (with object keys, latitude & longitude).

If your data is already formatted in that way, you can reference tableName.data in the map's Points field. If your data is not yet formatted that way, we may need to do some javascript transformation. Happy to help with that too!

Hi Tess,
Many thanks for your prompt response.

Is my understanding correct that for the Map to show point objects then one needs to point to the lat/long columns in the table in the Points section of the Contents, and the GeoJSON section is for line and polygon objects?

If so, what do I place in the GeoJSON section if I have only points to show?

Attached are two screenshots of what I have at this stage.

Thank you.
PointsFromTableColumns
SampleCoordinates

Correct!

Some generic JSON like this should resolve the error without impacting the component:

{
   "type":"FeatureCollection",
   "features":[]
}

1 Like

Thank you again Tess!

So basically all I need to do is as shown in the attached screenshot?

May I ask what coordinate system does the map expects? My data is on WGS84.

Thanks
PointsOnMap

Thanks Tess. Problem solved by referring to your example :slight_smile:

Glad to hear! Looking at the Mapbox docs, I believe it is using the WGS84 datum