A protocol-aware map that separates data sources from rendering layers.

const map = new HonuaMap({ client });

map.addSource("parcels", {
type: "honua-feature-service",
url: "https://gis.example.com/rest/services/parcels/FeatureServer/0",
definitionExpression: "status = 'active'",
});

map.addLayer({
id: "parcel-fill",
source: "parcels",
type: "fill",
paint: { "fill-color": "#088", "fill-opacity": 0.5 },
});

map.addLayer({
id: "parcel-labels",
source: "parcels",
type: "symbol",
layout: { "text-field": ["get", "parcel_id"] },
});

// Access the underlying surface for queries
const parcels = map.getSource("parcels"); // HonuaFeatureLayer
const count = await (parcels as HonuaFeatureLayer).queryFeatureCount();

Constructors

Accessors

Methods

  • Add a rendering layer.

    Layers reference a source by name. Multiple layers can reference the same source (e.g. a fill layer and a symbol layer over the same Feature Service).

    Parameters

    • spec: HonuaLayerSpecification

      Layer specification (must include id, source, type).

    • OptionalbeforeId: string

      Insert this layer before the layer with this ID. If omitted, appends to the end.

    Returns void

    If the referenced source does not exist.

    If a layer with the same ID already exists.

  • Register a named data source.

    Honua sources (honua-feature-service, honua-map-service, honua-ogc-features) are resolved into SDK surface instances. Native MapLibre sources (vector, raster, geojson) are stored as-is and resolve to null.

    Parameters

    Returns void

    If a source with the same name already exists.

  • Move a layer to a new position in the render order.

    Parameters

    • id: string

      The layer to move.

    • OptionalbeforeId: string

      Place it before this layer. If omitted, moves to end.

    Returns void

  • Replace a source specification while preserving layers that reference it.

    This updates the resolved SDK surface for Honua custom source types and leaves render layers in place so callers can decide how to patch the renderer.

    Parameters

    Returns void

    If the source does not exist.