Skip to main content

@mapcairn/sdk/browser

The @mapcairn/sdk/browser entry point of @mapcairn/sdk.

Checked against version 0.2.0. Import from @mapcairn/sdk/browser.

Ports​

Functions​

  • defineMapElement: Registers the <mapcairn-map> element, or one under another name.
  • mountMap: Draws a map in element and returns the handle to move, change and remove it.

Classes​

  • LayerError: The only error a layer source rejects with.
  • LocationError: The only error a location provider throws, apart from PortAbortError.
  • MapEngineError: The only error a map adapter rejects with when its engine cannot start, and the payload of its fatalError event when the engine stops later.
  • MountMapError: What drawing a map, its handle and an element's definition throw for a call that cannot work.
  • PortAbortError: Thrown by an async port when the caller's AbortSignal fires before the work finishes.
  • RoutingError: The only error a routing provider rejects with.
  • SearchError: The only error a search provider throws, apart from PortAbortError.

Types​

  • AreaGeometry: The outline of an area, as GeoJSON writes a Polygon (a ring, then any holes) or a MultiPolygon.
  • BasemapAttributionEntry: One credit line a tile provider requires.
  • BasemapDefinition: A basemap, as data.
  • BasemapSource: Where a basemap's pixels come from.
  • Bounds: A geographic bounding box in decimal degrees.
  • CardSpec: What a feature's card shows.
  • CategoryColour: Colour by category, for alert levels and kinds.
  • ControlBase: The fields every layer control has, whatever its kind.
  • ControlCondition: Makes a control usable only while another control has one of some values, such as "Include smaller earthquakes" only for the hour and the day.
  • ControlValues: The value of each of a layer's controls, as strings, by control id.
  • DateBound: A calendar date: an ISO YYYY-MM-DD string, or a day relative to today (UTC).
  • DateControlDefinition: A calendar day, bounded on both sides.
  • DateTimeBound: A slot of a date and time control: a UTC YYYY-MM-DDtHHMM string on the control's step, such as 2000-06-01t0000, or a time relative to now.
  • DateTimeControlDefinition: A UTC date and a time of day on a fixed step, such as the half hours of a product the provider names by timestamp.
  • DefinitionText: Text a definition shows a person: a MessageKey, looked up in the active catalogue where the definition is rendered; a HostText, a host's own key with its…
  • DerivedVariable: A URL variable computed from control values with a lookup table, for feeds whose file names combine several choices.
  • DetailSource: A second source fetched only when someone asks for it on one feature, such as an event's affected area.
  • FeatureFilter: Keeps the features whose decoded field equals one of in.
  • FeedLayerDefinition: A layer of features from a feed: points with a point style (no kind), or polygons or lines with a shapes style.
  • FeedShapeStyle: A feed shape style whose label may use a host-keyed template.
  • FeedSource: A feed: one JSON document of point features, fetched when the layer is on.
  • FieldMap: Where each decoded field comes from: a field name mapped to a dotted path into a raw feature, such as properties.mag or geometry.coordinates.2.
  • FieldValue: A decoded field value.
  • FillPattern: How a polygon is hatched, so a fill's meaning never rests on colour alone.
  • FixedColour: One colour for every feature.
  • HeatmapLayerDefinition: Point density from a feed or a query, drawn as a heatmap.
  • HeatmapSpec: How a heatmap is drawn.
  • HeatmapValue: A number a heatmap reads: fixed in the definition, or taken from one of the layer's range controls so the person can tune it.
  • HostText: A host's own translatable definition text: a host-defined catalogue key and the text shown in the source language, which is also the fallback when the active…
  • IdentifiableLayerDefinition: A raster tile layer that answers a tap.
  • IdentifySource: Asks a service what a raster tile layer shows at a tapped place, as a WMS GetFeatureInfo request does.
  • IdentifyTarget: Where a tap landed, for a tile layer's identify request.
  • KeyedLayerText: A host-defined translation key and its source text for a layer template.
  • LatLng: A geographic position in decimal degrees (WGS 84).
  • LayerAttribution: A credit line a provider asks for.
  • LayerControlDefinition: Every kind of control a layer can offer.
  • LayerDefinition: One open data layer, as data.
  • LayerDefinitionBase: The fields every layer definition has, whatever its kind.
  • LayerDetailRequest: What LayerSource needs.
  • LayerErrorKind: Why a layer could not load: the request failed (network), the response could not be decoded (invalid), it held no features (empty, which only load and…
  • LayerFeature: One decoded feature: an id, its geometry and the fields its definition maps.
  • LayerGeometry: The geometry of a decoded feature: the GeoJSON types a layer can draw.
  • LayerIdentifyRequest: What LayerSource needs.
  • LayerLoadRequest: What LayerSource needs.
  • LayerTemplate: A literal layer template or a host-keyed template with source text.
  • LineDash: How a line or outline is dashed.
  • ListSort: A sort option for the list of loaded features.
  • ListSpec: What each row of the list of loaded features shows.
  • LocateOptions: Options for a single location request.
  • LocationErrorKind: Why finding the user's location failed.
  • LocationFix: A position fix.
  • LocationWatchHandlers: Callbacks for a continuous watch.
  • MapCairnMapElement: The <mapcairn-map> element.
  • MapCairnMapElementClass: The class defineMapElement registers.
  • MapCairnMapEventMap: The events a <mapcairn-map> sends, by name.
  • MapEngineErrorReason: Why a map failed: its engine could not start without WebGL, the engine or its basemap could not load (load-failed), the engine stopped working after it had…
  • MapEvents: What a map reports, by event name.
  • MapFeatureHit: One feature of a data layer under a tap.
  • MapFeatureTap: A tap or click on a point, polygon or line of a feed layer: the topmost feature, and every feature under the tap (it included), topmost first and listed once…
  • MapHandle: A map that was drawn in an element.
  • MapLayersState: The layers of a map and whether the list is there.
  • MapLayerState: One layer of a map, as a page reads it.
  • MapLayerStatus: What a layer is doing, as a short name: off, on, loading, ready, empty, error, one of the tile layer's tiles- states, or a zoom limit.
  • MapStore: Something a page can read and listen to, in the shape of LayerCatalogue: getState returns the same object until the state changes, and subscribe calls the…
  • MapTool: The optional tools a page can add to the map: "search" (a search box, which needs services.search), "map-options" (the sheet with the basemaps, a pin and…
  • MapUpdate: What MapHandle can change after the map is mounted.
  • MarkerShape: The shapes a point marker can take, so colour is never the only signal.
  • MeasureMode: What is being measured.
  • MessageKey: A key into the shipped message catalogue.
  • MountAbout: The About block a page adds to Help: a heading, a line of text and up to two links.
  • MountEngineNotice: What a page says when its map cannot run, and what it offers to do about it.
  • MountLanguage: A language a page adds to English, as plain data.
  • MountLink: A link a page gives the map: where it goes and what it is called.
  • MountMapErrorKind: Why a call that draws or changes a map, or an element's definition, could not work:
  • MountMapOptions: Everything mountMap takes.
  • MountNotes: Notes a page words for what it knows and the map does not: which service answers a request and what is sent to it.
  • MountServices: The providers a page writes itself.
  • MountTour: A first-visit tour a page gives its map: a welcome card, steps that each end when the person does what they ask, and an ending.
  • MountTourCard: The words of a card of the tour that is not a step.
  • MountTourStep: One step of a tour: what TourStep of @mapcairn/core holds, with the heading and the text as plain text, a message key or text as written.
  • NoticeAction: Which notice's button was pressed.
  • OpacityControlDefinition: How opaque a tile overlay is, from 0.1 to 1.
  • PaletteSlot: A colour from the data palette, by name (see PALETTE_SLOTS).
  • PointStyle: How a feed's points are drawn, and so what its legend says.
  • Position: A longitude and latitude pair, in that order, as GeoJSON writes it.
  • QuerySource: A feed that is asked only for the features inside the current view, for a dataset too large to fetch whole.
  • RangeControlDefinition: A number between two bounds, such as a heatmap's radius.
  • ReachableAreaFeature: One area that can be reached within a time.
  • ReachableAreaRequest: A request for the area reachable from a place within a time.
  • ReachableAreaResult: The areas reachable from an origin: usually one, and more when the network is split.
  • RelativeDate: A date relative to today in UTC, so a definition never hard-codes a day that goes stale.
  • RelativeTime: A time relative to now, so a definition can follow a provider's latency: { minutesAgo: 360 } is six hours ago, rounded down to the control's step.
  • RouteLeg: One stretch of a route, between two consecutive stops.
  • RouteLineGeometry: A line of [longitude, latitude] positions, as GeoJSON writes a LineString.
  • RouteRequest: A request for a route through the stops, in order.
  • RouteResult: A route: one line feature for each leg, with totals.
  • RoutingCredit: A credit a routing service asks for while a route or travel-time area it found is shown, such as its data source, its own name or a link its usage terms…
  • RoutingErrorKind: Why a route or a travel-time area could not be found: the request failed (network), it was not valid (invalid), no route links the stops (no-route), the…
  • SearchErrorKind: Why a place search failed.
  • SearchOptions: Options for a search or a reverse lookup.
  • SearchResult: A place a search found.
  • SegmentedControlDefinition: A choice of a few values, drawn as a segmented control.
  • SegmentedOption: One option of a segmented control.
  • SetViewOptions: Options for MapHandle.
  • ShapeCategory: One category of a polygon or line style.
  • ShapeCategoryColour: Colour by category: a field's value picks the class.
  • ShapeColour: How a polygon or line layer is coloured.
  • ShapeFixedColour: One colour for every polygon or line.
  • ShapeIntervalColour: Graduated colour in equal intervals over a numeric field.
  • ShapeLabel: Text drawn on each polygon or line, filled from the feature's fields.
  • ShapeMarks: Marks a class can carry beside its colour.
  • ShapeStep: One value range of a polygon or line style, from explicit stops.
  • ShapeStepColour: Graduated colour from explicit stops (class breaks).
  • ShapeStyle: How polygons or lines are drawn: a fill (or a stroke, for lines) coloured by a rule, with outline width, hatching, dashing and labels.
  • SizeStops: Marker radius by value: the radius of the last stop at or below the value.
  • StepColour: Colour by ordered value ranges, using an ordered (ordinal) palette.
  • StyleCategory: One category of a categorical style.
  • SuggestOptions: Options for one suggestion request.
  • SwitchControlDefinition: An on and off choice.
  • ThemeChoice: The theme the user chose.
  • TileLayerDefinition: A raster overlay.
  • TileSource: Raster tiles drawn as an overlay, such as WMTS imagery or a WMS map.
  • TravelMode: How the traveller moves, which decides the roads and the speed.
  • VectorHeatmapLayer: One layer of a vector tile source whose points are drawn as a heatmap.
  • VectorShapeLayer: One layer of a vector tile source, drawn as polygons or lines.
  • VectorSourceLayer: Either way a vector tile source layer can be drawn.
  • VectorTileLayerDefinition: A vector tile layer: one source, drawn from one or more of its source layers, each with its own style and zoom window.
  • VectorTileSource: Vector tiles drawn by the map engine, styled per source layer.
  • ViewState: The visible part of the map.