GeoJson in Mapbox component for points

So, here's what I figured out...for the geojson...you need to format like this:

  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-122.454, 37.766],
      },
      "properties": {
        "marker": "1"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-122.510, 37.764],
      },
      "properties": {
        "marker": "2"
      }
    },
    // ... more features ...
  ]
}

You don't include anything for the points data.

For the geojson styling then you can dynamically set a color like this:

  "type": "circle",
  "paint": {
    "circle-color": [
      'match',
      ['get', 'marker'],
      '1', '#f00',
      '2', '#0f0',
      '3', '#00f',
      '4', '#f0f',
      '#000' // default color
    ]
  }
}

This renders pretty circles of the correct color for each of my coordinates. The problem is that they're just for show. Since they aren't "points" as far as Retool is concerned, none of the critical functions that rely on points existing work. For example. selectedPoint doesn't define anything since you can't actually select one of these coordinates.

So, this design I wanted is possible, but it leaves out the functionality I need.

1 Like