apache/superset · error · Error

Longitude and latitude columns are required

Error message

Longitude and latitude columns are required

What it means

Thrown by the point-cluster-map plugin's buildQuery when the form data is missing the longitude (all_columns_x) or latitude (all_columns_y) column. The map has nothing to plot without coordinates, so query construction aborts before a request is sent. This is a form-state validation error, nearly always caused by a chart whose controls were never fully configured or whose columns disappeared.

Source

Thrown at superset-frontend/plugins/plugin-chart-point-cluster-map/src/buildQuery.ts:47

  all_columns_x?: string;
  all_columns_y?: string;
  map_label?: string[];
  point_radius?: string;
  clustering_radius?: string;
  pandas_aggfunc?: string;
  global_opacity?: number;
  maplibre_style?: string;
  mapbox_style?: string;
  map_color?: string;
  render_while_dragging?: boolean;
  point_radius_unit?: string;
}

export default function buildQuery(formData: MapLibreFormData) {
  const { all_columns_x, all_columns_y, map_label, point_radius } = formData;

  if (!all_columns_x || !all_columns_y) {
    throw new Error('Longitude and latitude columns are required');
  }

  return buildQueryContext(formData, (baseQueryObject: QueryObject) => {
    const columns: QueryFormColumn[] = [
      ...ensureIsArray(baseQueryObject.columns || []),
      all_columns_x,
      all_columns_y,
    ];

    // Add label column if specified and not 'count'
    const hasCustomMetric =
      map_label && map_label.length > 0 && map_label[0] !== 'count';
    if (hasCustomMetric) {
      columns.push(map_label[0]);
    }

    // Add point radius column if not "Auto"
    if (point_radius && point_radius !== 'Auto') {

View on GitHub (pinned to f4587218dd)

Solutions

  1. Open the chart in Explore and set both the longitude (X) and latitude (Y) columns in the control panel, then save.
  2. If the dataset changed, rebind the chart to columns that exist (or restore/rename the removed column in the dataset).
  3. When building query contexts programmatically, include all_columns_x/all_columns_y in formData before invoking buildQuery.

Example fix

// before
const query = buildQuery({ ...formData }); // all_columns_x undefined -> throws

// after
if (!formData.all_columns_x || !formData.all_columns_y) {
  throw new Error('Configure longitude/latitude columns before querying');
}
const query = buildQuery(formData);
Defensive patterns

Strategy: validation

Validate before calling

if (!formData.all_columns_x || !formData.all_columns_y) {
  throw new Error('Point cluster map requires longitude and latitude columns');
}
const query = buildQuery(formData);

Type guard

const hasCoordinateColumns = (fd: MapLibreFormData): boolean =>
  Boolean(fd.all_columns_x) && Boolean(fd.all_columns_y);

Try / catch

try { buildQuery(formData); } catch (e) { if (e.message === 'Longitude and latitude columns are required') showConfigToast('Set X/Y columns'); else throw e; }

Prevention

When it happens

Trigger: Rendering/running a Point Cluster Map chart where all_columns_x or all_columns_y is empty — e.g. a newly added chart sliced before columns were chosen, a saved chart whose dataset dropped/renamed the bound column, or a programmatic query_context payload built without those keys.

Common situations: Dataset schema drift (column renamed/deleted) breaking saved dashboards; importing/changing the dataset of an existing chart; dashboards loaded from JSON export where the form params omit the coordinate columns.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/47e683fd650c89ff. Report an issue: GitHub.