Candidate GeoJSON object.
See ValidatorOptions.
{ valid, error }; error is null when valid.
// FeatureCollection valide
const geojson = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: { type: "Point", coordinates: [-73.5673, 45.5017] },
properties: { name: "Montreal" },
},
],
};
GeoLeaf.Validators.validateGeoJSON(geojson);
// Returns: { valid: true, error: null }
// GeoJSON invalide (features manquant)
GeoLeaf.Validators.validateGeoJSON({ type: "FeatureCollection" });
// Returns: { valid: false, error: 'FeatureCollection must have a features array' }
Validates the structure of a GeoJSON object.
⚠️ Structural only: it checks that the
typeis known and that aFeatureCollectioncarries afeaturesarray. It does not walk the geometries, so coordinates are not range-checked — pair it with validateCoordinates where that matters.Like its siblings it throws a
ValidationErrorwhenthrowOnErroris set — but the throw is delegated to the shared_geoJSONCheckhelper rather than raised here, so this block carries no@throwstag: TSD-03 requires the tag to sit above a literalthrow, and it does not follow the call graph.