{"record":{"id":"864e6934f9da963a","repo":"mrdoob/three.js","slug":"unknown-geometry-type","errorCode":null,"errorMessage":"unknown geometry type.","messagePattern":"unknown geometry type\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"manual/resources/tools/geo-picking/make-geo-picking-texture.js","lineNumber":140,"sourceCode":"\n\t\t\tconst r = ( id >> 0 ) & 0xFF;\n\t\t\tconst g = ( id >> 8 ) & 0xFF;\n\t\t\tconst b = ( id >> 16 ) & 0xFF;\n\n\t\t\tcountryData[ name ] = {\n\t\t\t\tcolor: [ r, g, b ],\n\t\t\t\tid: id ++,\n\t\t\t};\n\t\t\tcountriesById.push( { name } );\n\n\t\t}\n\n\t\tconst countryInfo = countriesById[ countryData[ name ].id - 1 ];\n\n\t\tconst handler = geoHandlers[ type ];\n\t\tif ( ! handler ) {\n\n\t\t\tthrow new Error( 'unknown geometry type.' );\n\n\t\t}\n\n\t\tresetMinMax();\n\n\t\tworkCtx.save();\n\t\tworkCtx.clearRect( 0, 0, workCtx.canvas.width, workCtx.canvas.height );\n\t\tworkCtx.fillStyle = '#000';\n\t\tworkCtx.strokeStyle = '#000';\n\t\tworkCtx.translate( workCtx.canvas.width / 2, workCtx.canvas.height / 2 );\n\t\tworkCtx.scale( workCtx.canvas.width / 360, workCtx.canvas.height / - 180 );\n\n\t\thandler( workCtx, geometry, fill );\n\n\t\tworkCtx.restore();\n\n\t\tcountryInfo.min = min;\n\t\tcountryInfo.max = max;","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/manual/resources/tools/geo-picking/make-geo-picking-texture.js#L122-L158","documentation":"Thrown by the geo-picking texture generator when a GeoJSON feature's geometry.type is not in geoHandlers, which only registers 'Polygon' and 'MultiPolygon'. The draw() function reads geometry.type from each area feature and looks up the handler; unhandled geometry kinds (Point, LineString, MultiLineString, GeometryCollection, etc.) abort the whole texture build.","triggerScenarios":"Feeding country boundary GeoJSON that contains a non-polygon feature — e.g. a Point for a capital city, a LineString for a border, or a GeometryCollection. Using a different natural-earth dataset whose feature geometry types differ from the expected Polygon/MultiPolygon.","commonSituations":"Swapping the source shapefile/GeoJSON for the picking-texture tool to a richer dataset that includes point/line layers. Editing the dataset and accidentally leaving in a metadata feature with a non-polygon geometry.","solutions":["Pre-filter the GeoJSON to features whose geometry.type is 'Polygon' or 'MultiPolygon' before drawing.","If you need line/point features, register handlers in geoHandlers (e.g. 'LineString': lineFeature) and implement the draw routine.","Skip unknown types instead of throwing: in draw(), 'if (!handler) return;' after logging, rather than aborting."],"exampleFix":"// before — non-polygon feature aborts everything\nfor ( const area of features ) draw( area ); // area.geometry.type === 'Point' -> throws\n\n// after — skip features the handler cannot draw\nconst features = geoJSON.features.filter(\n  f => f.geometry.type === 'Polygon' || f.geometry.type === 'MultiPolygon'\n);\nfor ( const area of features ) draw( area );","handlingStrategy":"validation","validationCode":"const SUPPORTED_GEO = new Set( [ 'Polygon', 'MultiPolygon' ] );\nfunction filterPolygons( features ) {\n  return features.filter( f => SUPPORTED_GEO.has( f.geometry && f.geometry.type ) );\n}","typeGuard":"function isHandledGeometry( type ) {\n  return type === 'Polygon' || type === 'MultiPolygon';\n}","tryCatchPattern":"const handler = geoHandlers[ type ];\nif ( ! handler ) { console.warn( 'skipping unsupported geometry:', type ); return; }","preventionTips":["Pre-filter GeoJSON features to Polygon/MultiPolygon before drawing.","Register handlers in geoHandlers before adding non-polygon layers.","Log skipped geometry types instead of aborting the whole texture."],"tags":["geo","manual","geojson","geo-picking"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}