GeoLeaf Core API - v3.0.0
    Preparing search index...
    • Validates the structure of a GeoJSON object.

      ⚠️ Structural only: it checks that the type is known and that a FeatureCollection carries a features array. 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 ValidationError when throwOnError is set — but the throw is delegated to the shared _geoJSONCheck helper rather than raised here, so this block carries no @throws tag: TSD-03 requires the tag to sit above a literal throw, and it does not follow the call graph.

      Parameters

      Returns { valid: boolean; error: string | null }

      { 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' }