Bug description

Summary

I'm using the "deck.gl GeoJSON" chart type in Apache Superset to visualize a GeoJSON dataset that includes valid Polygon geometries. The chart fails to render any shapes and shows "0 rows" returned, even though the dataset contains 45 rows with valid-looking GeoJSON strings in the geometry_json column. Steps to Reproduce

Upload a cleaned GeoJSON file (converted from a shapefile) as a dataset.

Use geometry_json as the GeoJson Column in a deck.gl GeoJSON chart.

Leave "Ignore null locations" checked (default).

Click "Update Chart."

Expected Behavior

The chart should render the polygon shapes from the dataset. Actual Behavior

Superset reports “0 rows” returned, even though valid rows are visible in the data preview.

Unchecking “Ignore null locations” allows rendering in some cases, but behavior is inconsistent.

Geometry column values are in the form:

{ "type": "Polygon", "coordinates": [[[-94.60..., 39.23...], ...]] }

Possible Causes

Superset may be overly strict in checking for nulls or geometry validity.

Superset might be expecting full GeoJSON Feature or FeatureCollection structure rather than raw Polygon objects.

Environment

Apache Superset version: [insert version here]

Dataset uploaded as: GeoJSON

Chart type: deck.gl GeoJSON

Attachments

Screenshot of chart setup

Sample of geometry_json values from dataset

Request

Clarify the expected structure of the GeoJSON column

Suggest best practices for pre-processing spatial data for deck.gl charts

Fix or improve handling of basic geometry objects that are structurally valid but not wrapped in a Feature

Screenshots/recordings

Image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Firefox

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hi @IDunnThat! I'm Dosu and I’m helping the superset team.

Your suspicion is correct: the deck.gl GeoJSON chart in Apache Superset expects each geometry to be wrapped as a GeoJSON Feature, or ideally, as part of a FeatureCollection. The code and sample payloads in the Superset repository show that the expected structure is either a single Feature (with type: "Feature", a geometry object, and optional properties) or a FeatureCollection (with type: "FeatureCollection" and a features array of Feature objects) [example payload] [Geojson.tsx processing].

If your geometry_json column contains only raw Polygon objects (e.g., { "type": "Polygon", ... }), Superset will not recognize them as valid features for rendering. You should preprocess your data so that each row's geometry is wrapped like this:

{
  "type": "Feature",
  "geometry": { "type": "Polygon", "coordinates": [...] },
  "properties": {}
}

Or, if you are combining multiple geometries, use a FeatureCollection:

{
  "type": "FeatureCollection",
  "features": [
    { "type": "Feature", "geometry": { ... }, "properties": {} },
    ...
  ]
}

Best practices for pre-processing: ensure every geometry is a valid GeoJSON Feature, and if possible, validate your GeoJSON using a tool or library before uploading. If your data comes from shapefiles or other GIS sources, use tools like ogr2ogr or Python's geopandas to export as GeoJSON Features.

There are no existing issues or discussions in the Superset repository that address this specific problem with raw geometry objects not rendering. The inconsistent behavior when toggling "Ignore null locations" is likely a side effect of the chart's strict validation for the expected GeoJSON structure.

Wrapping your geometries as Features should resolve the "0 rows" issue and allow deck.gl to render your polygons as expected.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: rusackas

I think the bot's right, there just needs to be another layer of JSON metadata here. Please let us know if its suggestion indeed clears the issue so we can close it or discuss further.

Comment From: rusackas

Indeed the bot seems to be right. Here's a sampler platter query that seems to work just fine:

SELECT '{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-122.4194, 37.7749]
      },
      "properties": {
        "name": "San Francisco",
        "category": "city",
        "population": 873965
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-74.0060, 40.7128]
      },
      "properties": {
        "name": "New York City",
        "category": "city",
        "population": 8336817
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-122.4194, 37.7749],
          [-118.2437, 34.0522],
          [-87.6298, 41.8781],
          [-74.0060, 40.7128]
        ]
      },
      "properties": {
        "name": "Cross-country route",
        "type": "highway",
        "length_miles": 2900
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [-109.0448, 41.0006],
          [-102.0517, 41.0006],
          [-102.0517, 36.9931],
          [-109.0448, 36.9931],
          [-109.0448, 41.0006]
        ]]
      },
      "properties": {
        "name": "Colorado",
        "type": "state",
        "area_sq_miles": 104094
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [-87.6298, 41.8781],
          [-87.5298, 41.8781],
          [-87.5298, 41.9781],
          [-87.6298, 41.9781],
          [-87.6298, 41.8781]
        ]]
      },
      "properties": {
        "name": "Chicago Downtown",
        "type": "district",
        "density": "high"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPoint",
        "coordinates": [
          [-118.2437, 34.0522],
          [-118.1937, 34.0622],
          [-118.2937, 34.0422]
        ]
      },
      "properties": {
        "name": "LA Metro Stations",
        "type": "transit",
        "system": "metro"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiLineString",
        "coordinates": [
          [
            [-122.4194, 37.7749],
            [-122.3194, 37.7849]
          ],
          [
            [-122.5194, 37.7649],
            [-122.4094, 37.7549]
          ]
        ]
      },
      "properties": {
        "name": "Bay Area Bridges",
        "type": "infrastructure",
        "bridges": ["Golden Gate", "Bay Bridge"]
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [[
            [-157.8583, 21.3099],
            [-157.8083, 21.3099],
            [-157.8083, 21.3599],
            [-157.8583, 21.3599],
            [-157.8583, 21.3099]
          ]],
          [[
            [-156.3319, 20.7984],
            [-156.2819, 20.7984],
            [-156.2819, 20.8484],
            [-156.3319, 20.8484],
            [-156.3319, 20.7984]
          ]]
        ]
      },
      "properties": {
        "name": "Hawaiian Islands",
        "type": "archipelago",
        "islands": ["Oahu", "Maui"]
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [-80.1918, 25.7617],
          [-80.1318, 25.7617],
          [-80.1318, 25.8217],
          [-80.1918, 25.8217],
          [-80.1918, 25.7617]
        ], [
          [-80.1718, 25.7817],
          [-80.1518, 25.7817],
          [-80.1518, 25.8017],
          [-80.1718, 25.8017],
          [-80.1718, 25.7817]
        ]]
      },
      "properties": {
        "name": "Miami with Lake",
        "type": "city_with_hole",
        "description": "Polygon with interior hole"
      }
    }
  ]
}' as JSON