aboutsummaryrefslogtreecommitdiffstats
path: root/src/Mapbox/Source.elm
diff options
context:
space:
mode:
authorJakub Hampl <kopomir@gmail.com>2018-08-24 12:29:25 +0100
committerJakub Hampl <kopomir@gmail.com>2018-08-24 12:29:25 +0100
commit2e9381479d484d383238493306421327623bc4a2 (patch)
tree56a58d4501f0618b1b4fa1164e909e06e0df3daf /src/Mapbox/Source.elm
parentaf8b5c077da700236667ccb3cdcd736774dd9e3b (diff)
v0.48 compatibility, docs improvements, polish
Diffstat (limited to 'src/Mapbox/Source.elm')
-rw-r--r--src/Mapbox/Source.elm25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/Mapbox/Source.elm b/src/Mapbox/Source.elm
index 8cccfd8..f472963 100644
--- a/src/Mapbox/Source.elm
+++ b/src/Mapbox/Source.elm
@@ -1,4 +1,4 @@
-module Mapbox.Source exposing (Coords, GeoJSONSource, Id, RasterSource, Scheme(..), Source, SourceOption, Url, VectorSource, animatedCanvas, attribution, bounds, buffer, cluster, clusterRadius, encode, geoJSONFromUrl, geoJSONFromValue, getId, image, lineMetrics, maxzoom, minzoom, raster, rasterDEMMapbox, rasterDEMTerrarium, rasterFromUrl, scheme, staticCanvas, tileSize, tolerance, vector, vectorFromUrl, video)
+module Mapbox.Source exposing (Coords, GeoJSONSource, Id, RasterSource, Scheme(..), Source, SourceOption, Url, VectorSource, animatedCanvas, attribution, bounds, buffer, cluster, clusterRadius, encode, generateIds, geoJSONFromUrl, geoJSONFromValue, getId, image, lineMetrics, maxzoom, minzoom, raster, rasterDEMMapbox, rasterDEMTerrarium, rasterFromUrl, scheme, staticCanvas, tileSize, tolerance, vector, vectorFromUrl, video)
{-|
@@ -27,7 +27,7 @@ module Mapbox.Source exposing (Coords, GeoJSONSource, Id, RasterSource, Scheme(.
### GeoJSON
-@docs geoJSONFromUrl, geoJSONFromValue, GeoJSONSource, buffer, tolerance, cluster, clusterRadius, lineMetrics
+@docs geoJSONFromUrl, geoJSONFromValue, GeoJSONSource, buffer, tolerance, cluster, clusterRadius, lineMetrics, generateIds
### Image, Video & Canvas
@@ -165,11 +165,19 @@ tolerance float =
SourceOption "tolerance" (Json.Encode.float float)
-{-| If the data is a collection of point features, setting this to true clusters the points by radius into groups.
+{-| If the data is a collection of point features, setting this clusters the points by radius into groups.
+
+Cluster groups become new Point features in the source with additional properties:
+
+ - `cluster` Is `True` if the point is a cluster
+ - `cluster_id` A unqiue id for the cluster.
+ - `point_count` Number of original points grouped into this cluster
+ - `point_count_abbreviated` An abbreviated point count
+
-}
-cluster : Bool -> SourceOption GeoJSONSource
+cluster : SourceOption GeoJSONSource
cluster =
- Json.Encode.bool >> SourceOption "cluster"
+ Json.Encode.bool True |> SourceOption "cluster"
{-| Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile.
@@ -193,6 +201,13 @@ lineMetrics =
Json.Encode.bool >> SourceOption "lineMetrics"
+{-| When set, the feature.id property will be auto assigned based on its index in the features array, over-writing any previous values.
+-}
+generateIds : SourceOption GeoJSONSource
+generateIds =
+ Json.Encode.bool True |> SourceOption "generateId"
+
+
{-| Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed.
-}
scheme : Scheme -> SourceOption RasterSource