Pragmatic implementation of OGC API -- Features Parts 1 and 4
Visualize and modify Layers from OGC API -- Features Servers in Leaflet.
This is still work in progress and takes some assumptions which are not fully standard compliant.
See demo.html for a minimal demo.
Represents FeatureCollections offered by an OGC API as described in OGC API -- Features 7.13 Collections as a list of FeatureCollection Leaflet Layers. This currently filters for collections with at least a link-relation "items".
Method | Parameters | Response |
---|---|---|
constructor |
|
Collections instance |
getLayers | None | List of all FeatureCollection layers. |
getLayer | collection_id | FeatureCollection for the given collection id |
createCollection | Collection Metadata | Promise returning a FeatureCollection on success. |
Option | Description |
---|---|
fetch_options | Options applied to all fetch operations. Use this if you need to set e.g. Headers. |
pagination_limit | Maximum number of features to fetch in one batch. Default: Use Server default. |
feature_limit | Maximum total number of features to load. Default: unlimited. |
Options from Leaflet.GeoJSON. These are applied to each FeatureCollection.
Extends Leaflet.GeoJSON. Uses Feature IDs from the server to allow for seamless updates.
Method | Parameters | Response |
---|---|---|
constructor | FeatureCollection instance | |
configure | Collection Metadata | Promise. Updates the metadata of this FeatureCollection on success |
subscribe | None. Requires link with relation "hub" pointing to a SSE endpoint in metadata of this FeatureCollection. | None. Updates features in this FeatureCollection based on SSE events |
unsubscribe | None. Drops SSE stream | |
delete | Promise. Deletes this collection from the server | |
createFeature | Leaflet Layer implementing toGeojson | Promise. Creates this Layer as new Item in the FeatureCollection on the server. Adds the given layer to this FeatureCollection |
updateFeature | Leaflet Layer from this FeatureCollection | Promise. Updates this Layer on the server |
deleteFeature | Leaflet Layer from this FeatureCollection | Promise. Deletes this Layer on the server and removes it from this FeatureCollection |
More methods inherited from Leaflet.GeoJSON.
Option | Description |
---|---|
fetch_options | Options applied to all fetch operations. Use this if you need to set e.g. Headers. |
pagination_limit | Maximum number of features to fetch in one batch. Default: Use Server default. |
feature_limit | Maximum total number of features to load. Default: unlimited. |
Options from Leaflet.GeoJSON.