diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/MapCommands.md | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/docs/MapCommands.md b/docs/MapCommands.md index 37621f3..c1d7eea 100644 --- a/docs/MapCommands.md +++ b/docs/MapCommands.md @@ -1,6 +1,6 @@ # MapCommands -This module has a bunch of essentially imperative commands for your map. +Tell your map to do something! Most of these Commands tell your map to (with or without animation) to show a different location. You can use the options from `Mapbox.Cmd.Option` to configure these. #### `id : String` @@ -75,12 +75,6 @@ Supported options: - `screenSpeed` - `maxDuration` -#### `stop : Cmd msg` - -Stops any animated transition underway. - -## Fitting bounds - #### `fitBounds : List (Option { ... }) -> ( LngLat, LngLat ) -> Cmd msg` Pans and zooms the map to contain its visible area within the specified geographical bounds. This function will also reset the map's bearing to 0 if bearing is nonzero. @@ -94,41 +88,15 @@ Supported options: - `maxZoom` -## Right-to-left - -#### `setRTLTextPlugin : String -> Cmd msg` - -Sets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text). Necessary for supporting languages like Arabic and Hebrew that are written right-to-left. Takes a URL pointing to the Mapbox RTL text plugin source. - - -## Querying the map - -``` -type Response - = GetBounds Int ( LngLat, LngLat ) - | QueryRenderedFeatures Int (List Value) - | Error String -``` - -#### `queryResults : (Response -> msg) -> Sub msg` - -Receive results from the queries. - - -#### `getBounds : Int -> Cmd msg` - -Responds with the map's geographical bounds. Takes a numerical ID that allows you to associate the question with the answer. - -### `queryRenderedFeatures : Int -> List (Option { layers : S, filter : S, query : S }) -> Query -> Cmd msg` +#### `stop : Cmd msg` -Returns an array of GeoJSON Feature objects representing visible features that satisfy the query parameters. Takes a numerical ID that allows you to associate the question with the answer. +Stops any animated transition underway. -The response: The properties value of each returned feature object contains the properties of its source feature. For GeoJSON sources, only string and numeric property values are supported (i.e. null, Array, and Object values are not supported). -Each feature includes a top-level layer property whose value is an object representing the style layer to which the feature belongs. Layout and paint properties in this object contain values which are fully evaluated for the given zoom level and feature. +## Other -Features from layers whose visibility property is "none", or from layers whose zoom range excludes the current zoom level are not included. Symbol features that have been hidden due to text or icon collision are not included. Features from all other layers are included, including features that may have no visible contribution to the rendered result; for example, because the layer's opacity or color alpha component is set to 0. +#### `resize : Cmd msg` -The topmost rendered feature appears first in the returned array, and subsequent features are sorted by descending z-order. Features that are rendered multiple times (due to wrapping across the antimeridian at low zoom levels) are returned only once (though subject to the following caveat). +Resizes the map according to the dimensions of its container element. -Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple times in query results. For example, suppose there is a highway running through the bounding rectangle of a query. The results of the query will be those parts of the highway that lie within the map tiles covering the bounding rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple tiles due to tile buffering. +This command must be sent after the map's container is resized, or when the map is shown after being initially hidden with CSS. |