Skip to content

Layer features ​

Workspace Key draft workspace layer mapp

Inline layer features, and featureSet and featureLookup which restrict and enrich the features a layer displays; use for layers without a table or showing a subset of one.

Resource and sources

Inline features. A vector format layer with features parses them with featureFormat, which defaults to format, and never requests data; reload only re-renders.[1] geojson features are GeoJSON Feature objects with id, geometry and properties; wkt features are records [id, wkt_geometry, …fields]. The geometry is read in srid, so srid and qID are still required.[2] There is no vector feature format: a vector layer with features sets featureFormat.

featureSet lists the feature IDs which are displayed. The MAPP library converts the array to a Set; features whose id is not in it are not styled, and clustering ignores them.[3]

featureLookup is an array of objects. A feature is displayed only when an object's featureLookupId property, id by default, equals the feature ID; the object's properties are then assigned to the feature, so themes and labels can use them. On an MVT layer a featureLookup requests tiles with geometry and ID only, so the lookup supplies the properties.[4]

The zoom to extent button of a layer with a featureSet or featureLookup queries the extent of those IDs only.[5] Location layer entries set featureSet and featureLookup from the location's data at runtime.

Pitfalls ​

  • IDs are compared with ===: ["1", "2"] matches no integer IDs. Use the type the query returns for qID.
  • An empty featureSet displays every feature; an empty featureLookup displays none.
  • featureLookup takes precedence over featureSet for the extent query.

Examples ​

The devdb locations restricted to two IDs, and an inline GeoJSON point.

json
{
  "dbs": "DEVDB",
  "locale": {
    "layers": {
      "capitals": {
        "display": true,
        "format": "wkt",
        "table": "example.locations",
        "geom": "geom",
        "srid": "4326",
        "qID": "id",
        "featureSet": [2, 3]
      },
      "inline": {
        "display": true,
        "format": "vector",
        "featureFormat": "geojson",
        "srid": "4326",
        "qID": "id",
        "features": [
          {
            "type": "Feature",
            "id": 1,
            "geometry": { "type": "Point", "coordinates": [-0.1276, 51.5072] },
            "properties": { "name": "Geolytix" }
          }
        ]
      }
    }
  }
}

  1. layer/format/vector.mjs vector, setSource and reload ↩︎

  2. layer/featureFormats.mjs geojson and wkt ↩︎

  3. layer/featureStyle.mjs featureProperties; format/vector.mjs clusterGeometry ↩︎

  4. layer/format/mvt.mjs wktTileUrlFunction ↩︎

  5. decorate.mjs getExtent ↩︎

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.