mrdoob/three.js · error
unknown geometry type.
Error message
unknown geometry type.
What it means
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.
Source
Thrown at manual/resources/tools/geo-picking/make-geo-picking-texture.js:140
const r = ( id >> 0 ) & 0xFF;
const g = ( id >> 8 ) & 0xFF;
const b = ( id >> 16 ) & 0xFF;
countryData[ name ] = {
color: [ r, g, b ],
id: id ++,
};
countriesById.push( { name } );
}
const countryInfo = countriesById[ countryData[ name ].id - 1 ];
const handler = geoHandlers[ type ];
if ( ! handler ) {
throw new Error( 'unknown geometry type.' );
}
resetMinMax();
workCtx.save();
workCtx.clearRect( 0, 0, workCtx.canvas.width, workCtx.canvas.height );
workCtx.fillStyle = '#000';
workCtx.strokeStyle = '#000';
workCtx.translate( workCtx.canvas.width / 2, workCtx.canvas.height / 2 );
workCtx.scale( workCtx.canvas.width / 360, workCtx.canvas.height / - 180 );
handler( workCtx, geometry, fill );
workCtx.restore();
countryInfo.min = min;
countryInfo.max = max;View on GitHub (pinned to da05705fa3)
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.
Example fix
// before — non-polygon feature aborts everything for ( const area of features ) draw( area ); // area.geometry.type === 'Point' -> throws // after — skip features the handler cannot draw const features = geoJSON.features.filter( f => f.geometry.type === 'Polygon' || f.geometry.type === 'MultiPolygon' ); for ( const area of features ) draw( area );
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_GEO = new Set( [ 'Polygon', 'MultiPolygon' ] );
function filterPolygons( features ) {
return features.filter( f => SUPPORTED_GEO.has( f.geometry && f.geometry.type ) );
} Type guard
function isHandledGeometry( type ) {
return type === 'Polygon' || type === 'MultiPolygon';
} Try / catch
const handler = geoHandlers[ type ];
if ( ! handler ) { console.warn( 'skipping unsupported geometry:', type ); return; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid length
- unsupported shape type: ${type}
- "transform stack empty!
- transform stack not 0
- no diagram ${name}
AI-assisted analysis of mrdoob/three.js@da05705fa3 (2026-08-12).
Data as JSON: /api/errors/864e6934f9da963a.
Report an issue: GitHub.