{"record":{"id":"523ba73eef8154ff","repo":"apache/superset","slug":"longitude-and-latitude-columns-are-required-for-la","errorCode":null,"errorMessage":"Longitude and latitude columns are required for latlong type","messagePattern":"Longitude and latitude columns are required for latlong type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"superset-frontend/plugins/preset-chart-deckgl/src/layers/spatialUtils.ts","lineNumber":81,"sourceCode":"  color_picker?: string;\n}\n\nexport interface SpatialPoint {\n  position: [number, number];\n  weight: number;\n  extraProps?: Record<string, unknown>;\n  [key: string]: unknown;\n}\n\nexport function getSpatialColumns(spatial: SpatialConfiguration): string[] {\n  if (!spatial || !spatial.type) {\n    throw new Error('Bad spatial key');\n  }\n\n  switch (spatial.type) {\n    case 'latlong':\n      if (!spatial.lonCol || !spatial.latCol) {\n        throw new Error(\n          'Longitude and latitude columns are required for latlong type',\n        );\n      }\n      return [spatial.lonCol, spatial.latCol];\n    case 'delimited':\n      if (!spatial.lonlatCol) {\n        throw new Error(\n          'Longitude/latitude column is required for delimited type',\n        );\n      }\n      return [spatial.lonlatCol];\n    case 'geohash':\n      if (!spatial.geohashCol) {\n        throw new Error('Geohash column is required for geohash type');\n      }\n      return [spatial.geohashCol];\n    default:\n      throw new Error(`Unknown spatial type: ${spatial.type}`);","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset-frontend/plugins/preset-chart-deckgl/src/layers/spatialUtils.ts#L63-L99","documentation":"Thrown by getSpatialColumns when spatial.type is 'latlong' but lonCol or latCol is missing. The latlong encoding needs two named columns (one for longitude, one for latitude) to emit into the query; either one absent makes the mapping impossible. It is a stricter, type-specific follow-up to the 'Bad spatial key' check.","triggerScenarios":"A spatial config like { type: 'latlong', lonCol: 'lon' } (latCol missing) reaching getSpatialColumns — typically after one of the two column controls was cleared, or a config built programmatically with only one coordinate field.","commonSituations":"User sets longitude but not latitude in the spatial control; dataset rename drops one of the two coordinate columns; hand-written form params with a typo (lonCol/latCol keys).","solutions":["Set both longitude and latitude columns in the chart's spatial control and save.","Fix programmatic configs so both lonCol and latCol are present whenever type is 'latlong'.","Check saved chart params JSON for typos or half-written spatial objects and correct via the chart API."],"exampleFix":"// before\ngetSpatialColumns({ type: 'latlong', lonCol: 'lon' }); // throws\n\n// after\ngetSpatialColumns({ type: 'latlong', lonCol: 'lon', latCol: 'lat' });","handlingStrategy":"validation","validationCode":"if (spatial.type === 'latlong' && (!spatial.lonCol || !spatial.latCol)) {\n  throw new Error('latlong spatial needs both lonCol and latCol');\n}\ngetSpatialColumns(spatial);","typeGuard":"const isCompleteLatlong = (s: SpatialConfiguration): boolean =>\n  s.type !== 'latlong' || (Boolean(s.lonCol) && Boolean(s.latCol));","tryCatchPattern":"try { getSpatialColumns(spatial); } catch (e) { if (e.message.includes('latlong type')) promptForCoordinateColumns(); else throw e; }","preventionTips":["Require both coordinate columns in the UI before run","Write integration tests covering half-filled spatial configs"],"tags":["deckgl","spatial","latlong","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}