Layers
Point Layers
KeplerGLBase.add_point_layer!
— Functionadd_point_layer!(m, table, latitude::Symbol, longitude::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantize",
highlight_color = colorant"#762A83",
altitude::Symbol = :null,
radius = 10.0,
radius_fixed = true,
radius_field::Symbol = :null,
radius_range = [5.0, 15.0],
radius_scale = "sqrt",
filled = true,
opacity = 1.0,
outline = false,
outline_thickness = 2.0,
outline_color = colorant"#000000",
outline_color_field::Symbol = :null,
outline_color_range = [colorant"#FFFFFF", colorant"#000000"],
outline_color_scale = "quantile")
Adds a point layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude::Symbol
: name of the column oftable
that contains the latitude of the pointslongitude::Symbol
: name of the column oftable
that contains the longitude of the points
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the points should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the pointscolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.altitude::Symbol = :null
: the name of the column oftable
that should be used for the altitude of the pointsradius = 10.0
: fixed radius value of the points on the mapradius_fixed = true
: whether the radius should be fixed or depend onradius_field
radius_field::Symbol = :null
: the name of the column oftable
that should be used for the radius of the pointsradius_range = [5.0, 15.0]
: range of the radii of the pointsradius_scale = "sqrt"
: how to mapradius_field
into the radiusfilled = true
: whether the point markers should be filled or notopacity = 1.0
: opacity of the points, between0.0
and1.0
outline = false
: whether the point markers should have an outlineoutline_thickness = 2.0
: thickness of the outlineoutline_color = colorant"#000000"
: aColors.jl
-compatible color that the point outlines should have (if fixed)outline_color_field::Symbol = :null
: the name of the column oftable
that should be used to color the point outlinesoutline_color_range = [colorant"#FFFFFF", colorant"#000000"]
: a vector ofColors.jl
-compatible colors for the outlines. Usecolorant"xyz"
to generate.outline_color_scale = "quantile"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the outline color
Examples
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
KeplerGL.add_point_layer!(m, df, :Latitude, :Longitude,
color = colorant"rgb(23,184,190)", color_field = :Magnitude, color_scale = "quantize",
color_range = ColorBrewer.palette("PRGn", 6),
radius_field = :Magnitude, radius_scale = "sqrt", radius_range = [4.2, 96.2], radius_fixed = false,
filled = true, opacity = 0.39, outline = false);
Polygon Layers
KeplerGLBase.add_polygon_layer!
— Functionadd_polygon_layer!(m::KeplerGLMap, table, geojson::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantize",
highlight_color = colorant"#762A83",
filled = true,
opacity = 1.0,
outline = false,
outline_opacity = 1.0,
outline_thickness = 2.0,
outline_color = colorant"#000000",
outline_color_field::Symbol = :null,
outline_color_range = [colorant"#FFFFFF", colorant"#000000"],
outline_color_scale = "quantile",
outline_width_field::Symbol = :null,
outline_width_scale = "linear",
height_field::Symbol = :null,
height_scale = "linear",
elevation_scale = 1.0,
enable_elevation_zoom_factor = true,
enable_3d = false)
Adds a polygon layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromgeojson::Symbo
: name of the column oftable
that contains the feature in GeoJSON format
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the shapes should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the shapescolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.filled = true
: whether the polygon is filled or not.opacity = 1.0
: opacity of the points, between0.0
and1.0
outline = false
: whether the point markers should have an outlineoutline_thickness = 2.0
: thickness of the outlineoutline_color = colorant"#000000"
: aColors.jl
-compatible color that the point outlines should have (if fixed)outline_color_field::Symbol = :null
: the name of the column oftable
that should be used to color the point outlinesoutline_color_range = [colorant"#FFFFFF", colorant"#000000"]
: a vector ofColors.jl
-compatible colors for the outlines. Usecolorant"xyz"
to generate.outline_color_scale = "quantile"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the outline coloroutline_width_field::Symbol = :null
: name of the column oftable
that should be used to determine the width of the polygon outlineoutline_width_scale = "linear"
: how the values inoutline_width_field
should be converted into the with of the outlineheight_field::Symbol = :null
: name of the column oftable
that should be used to determine the height of the featureheight_scale = "linear"
: howheight_field
should be converted into the actual heightelevation_scale = 1.0
: scaling factor for the heightenable_elevation_zoom_factor = true
enable_3d = false
: enable 3d on the layer
Examples
m = KeplerGL.KeplerGLMap(token, center_map=false, read_only=true)
df = CSV.read("assets/example_data/counties-unemployment.csv", DataFrame)
KeplerGL.add_polygon_layer!(m, df, :_geojson ,
color = colorant"red", color_field = :unemployment_rate, color_range = ColorBrewer.palette("RdPu", 9),
color_scale = "quantile", opacity = 0.8)
Hexbin Layers
KeplerGLBase.add_hexagon_layer!
— Functionadd_hexagon_layer!(m::KeplerGLMap, table, latitude::Symbol, longitude::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantile",
color_aggregation = "average",
highlight_color = colorant"#762A83",
radius = 0.6,
coverage = 0.95,
resolution = 8,
opacity = 1.0,
height_field::Symbol = :null,
height_scale = "sqrt",
height_percentile = [0,100],
height_aggregation = "average",
elevation_percentile = [0,100],
elevation_scale = 5,
enable_elevation_zoom_factor = true,
enable_3d = false)
Adds a hexbin layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude::Symbol
: name of the column oftable
that contains the latitude of the points to be aggregated into the hexbinlongitude::Symbol
: name of the column oftable
that contains the longitude of the points to be aggregated into the hexbin
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the hexagons should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the hexagonscolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.radius = 10.0
: fixed radius value of the hexagons on the mapcoverage = 0.95
: fraction of the hexagon area that should be coveredresolution = 8
opacity = 1.0
: opacity of the hexagons, between0.0
and1.0
height_field::Symbol = :null
: name of the column oftable
that should be used to determine the height of the hexagonsheight_scale = "sqrt"
: howheight_field
should be converted into the actual heightheight_percentile = [0,100]
:height_aggregation = "average"
:height_range = [0,500]
: range of the height of columnselevation_percentile = [0,100]
:elevation_scale = 5
: scaling factor for the heightenable_elevation_zoom_factor = true
enable_3d = false
: nable 3d on the layer
Examples
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
KeplerGL.add_hexagon_layer!(m, df, :Latitude, :Longitude, opacity = 0.5, color_field = :Magnitude, color_scale = "quantile",
radius = 20.0, color_range = ColorBrewer.palette("BuPu",6), color_aggregation = "average", coverage = 0.95,
height_field = :Magnitude )
Line Layers
KeplerGLBase.add_line_layer!
— Functionadd_line_layer!(m::KeplerGLMap, table, latitude0::Symbol, longitude0::Symbol,
latitude1::Symbol, longitude1::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantize",
highlight_color = colorant"#762A83",
altitude0::Symbol = :null,
altitude1::Symbol = :null,
size_field::Symbol = :null,
size_range = [1,10],
size_scale = "linear",
opacity = 1.0,
thickness = 2.0,
elevation_scale = 1)
Adds a line layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude0::Symbol
: name of the column oftable
that contains the latitude of the origin of the linelongitude0::Symbol
: name of the column oftable
that contains the longitude of the origin of the linelatitude1::Symbol
: name of the column oftable
that contains the latitude of the endpoint of the linelongitude1::Symbol
: name of the column oftable
that contains the longitude of the endpoint of the line
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the lines should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the linescolor_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"]
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.altitude0::Symbol = :null
: altitude of the origin of the line.altitude1::Symbol = :null
: altitude of the endpoint of the line.size_field::Symbol = :null
: name of the column oftable
that should be used for the line thicknesssize_range = [1,10]
: thickness range of the linessize_scale = "linear"
: howsize_field
should be converted into the actual line thicknessopacity = 1.0
: opacity of the linesthickness = 2.0
: line thickness, if constantelevation_scale = 1
: scaling factor for the altitude.
Examples
m = KeplerGL.KeplerGLMap(token, center_map=false)
df = CSV.read("assets/example_data/data.csv", DataFrame)
df.Latitude1 = df.Latitude .+ (rand(rng, Float64, length(df.Latitude)) .- 0.5)
df.Longitude1 = df.Longitude .+ 10.0 .* (rand(rng, Float64, length(df.Longitude)) .- 0.5)
KeplerGL.add_line_layer!(m, df, :Latitude, :Longitude, :Latitude1, :Longitude1,
opacity = 0.5, color_field = :Magnitude, color_scale = "quantile",
color_range = ColorBrewer.palette("BuPu",6), thickness = 3)
Arc Layers
KeplerGLBase.add_arc_layer!
— Functionadd_arc_layer!(m::KeplerGLMap, table, latitude0::Symbol, longitude0::Symbol,
latitude1::Symbol, longitude1::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantize",
highlight_color = colorant"#762A83",
altitude0::Symbol = :null,
altitude1::Symbol = :null,
size_field::Symbol = :null,
size_range = [1,10],
size_scale = "linear",
opacity = 1.0,
thickness = 2.0,
elevation_scale = 1)
Adds an arc layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude0::Symbol
: name of the column oftable
that contains the latitude of the origin of the linelongitude0::Symbol
: name of the column oftable
that contains the longitude of the origin of the linelatitude1::Symbol
: name of the column oftable
that contains the latitude of the endpoint of the linelongitude1::Symbol
: name of the column oftable
that contains the longitude of the endpoint of the line
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the lines should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the linescolor_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"]
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.altitude0::Symbol = :null
: altitude of the origin of the line.altitude1::Symbol = :null
: altitude of the endpoint of the line.size_field::Symbol = :null
: name of the column oftable
that should be used for the line thicknesssize_range = [1,10]
: thickness range of the linessize_scale = "linear"
: howsize_field
should be converted into the actual line thicknessopacity = 1.0
: opacity of the linesthickness = 2.0
: line thickness, if constantelevation_scale = 1
: scaling factor for the altitude.
Examples
m = KeplerGL.KeplerGLMap(token, center_map=false)
df = CSV.read("assets/example_data/data.csv", DataFrame)
df.Latitude1 = df.Latitude .+ (rand(rng, Float64, length(df.Latitude)) .- 0.5)
df.Longitude1 = df.Longitude .+ 10.0 .* (rand(rng, Float64, length(df.Longitude)) .- 0.5)
KeplerGL.add_arc_layer!(m, df, :Latitude, :Longitude, :Latitude1, :Longitude1,
opacity = 0.5, color_field = :Magnitude, color_scale = "quantile",
color_range = ColorBrewer.palette("BuPu",6), thickness = 3)
Grid Layers
KeplerGLBase.add_grid_layer!
— Functionadd_grid_layer!(m::KeplerGLMap, table, latitude::Symbol, longitude::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantile",
color_aggregation = "average",
highlight_color = colorant"#762A83",
radius = 0.6,
coverage = 0.95,
resolution = 8,
opacity = 1.0,
height_field::Symbol = :null,
height_scale = "sqrt",
height_percentile = [0,100],
height_aggregation = "average",
elevation_percentile = [0,100],
elevation_scale = 5,
enable_elevation_zoom_factor = true,
enable_3d = false)
Adds a grid layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude::Symbol
: name of the column oftable
that contains the latitude of the points to be aggregated into the hexbinlongitude::Symbol
: name of the column oftable
that contains the longitude of the points to be aggregated into the hexbin
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the hexagons should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the hexagonscolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.radius = 10.0
: fixed radius value of the hexagons on the mapcoverage = 0.95
: fraction of the hexagon area that should be coveredresolution = 8
opacity = 1.0
: opacity of the hexagons, between0.0
and1.0
height_field::Symbol = :null
: name of the column oftable
that should be used to determine the height of the hexagonsheight_scale = "sqrt"
: howheight_field
should be converted into the actual heightheight_percentile = [0,100]
:height_aggregation = "average"
:elevation_percentile = [0,100]
:elevation_scale = 5
: scaling factor for the heightenable_elevation_zoom_factor = true
enable_3d = false
: nable 3d on the layer
Examples
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
KeplerGL.add_grid_layer!(m, df, :Latitude, :Longitude, opacity = 0.5, color_field = :Magnitude, color_scale = "quantile",
radius = 20.0, color_range = ColorBrewer.palette("BuPu",6), color_aggregation = "average", coverage = 0.95,
height_field = :Magnitude )
Heatmap Layers
KeplerGLBase.add_heatmap_layer!
— Functionadd_heatmap_layer!(m::KeplerGLMap, table, latitude::Symbol, longitude::Symbol;
color = colorant"#762A83",
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
weight_field::Symbol = :null,
weight_scale = "linear",
highlight_color = colorant"#762A83",
radius = 0.6,
opacity = 1.0)
Adds a heatmap layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude::Symbol
: name of the column oftable
that contains the latitude of the points to be aggregated into the hexbinlongitude::Symbol
: name of the column oftable
that contains the longitude of the points to be aggregated into the hexbin
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the hexagons should have (if fixed)color_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.weight_field::Symbol = :null
: the name of the column oftable
that should be used to weigh the heatmapweight_scale = "linear"
: how theweight_field
should be translated into weightshighlight_color = colorant"#762A83"
: highlight color.radius = 10.0
: kernel width of the heatmapopacity = 1.0
: opacity of the layer, between0.0
and1.0
Examples
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
KeplerGL.add_heatmap_layer!(m, df, :Latitude, :Longitude, opacity = 0.5, weight_field = :Magnitude, weight_scale = "linear",
radius = 20.0, color_range = ColorBrewer.palette("BuPu",6) )
Cluster Layers
KeplerGLBase.add_cluster_layer!
— Functionadd_cluster_layer!(m::KeplerGLMap, table, latitude::Symbol, longitude::Symbol;
color = colorant"#762A83",
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
highlight_color = colorant"#762A83",
radius_range = [1,40],
cluster_radius = 20,
color_aggregation = "count",
color_field::Symbol = :null,
color_scale = "quantize",
opacity = 1.0)
Adds a cluster layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude::Symbol
: name of the column oftable
that contains the latitude of the points to be aggregated into the hexbinlongitude::Symbol
: name of the column oftable
that contains the longitude of the points to be aggregated into the hexbin
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the hexagons should have (if fixed)color_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_field::Symbol = :null
: the name of the column oftable
that should be used to color the cluster pointscolor_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.radius_range = [1,40]
: range for the point radiicluster_radius = 20
: radius for the clusteringcolor_aggregation = "count"
: how to aggregate the coloropacity = 1.0
: opacity of the layer, between0.0
and1.0
Examples
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
KeplerGL.add_cluster_layer!(m, df, :Latitude, :Longitude, opacity = 0.5, color_field = :Magnitude, color_scale = "quantile",
radius_range = [1,40], cluster_radius = 20, color_range = ColorBrewer.palette("BuPu",6), color_aggregation = "count" )
Icon Layers
KeplerGLBase.add_icon_layer!
— Functionadd_icon_layer!(m, table, latitude::Symbol, longitude::Symbol, icon::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantize",
highlight_color = colorant"#762A83",
altitude::Symbol = :null,
radius = 10.0,
radius_fixed = true,
radius_field::Symbol = :null,
radius_range = [5.0, 15.0],
radius_scale = "sqrt",
opacity = 1.0)
Adds an icon layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromlatitude::Symbol
: name of the column oftable
that contains the latitude of the pointslongitude::Symbol
: name of the column oftable
that contains the longitude of the pointsicon::Symbol
: name of the column oftable
that contains the strings with symbol names. See below for the list of valid symbol names.
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the points should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the pointscolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.altitude::Symbol = :null
: the name of the column oftable
that should be used for the altitude of the pointsradius = 10.0
: fixed radius value of the points on the mapradius_fixed = true
: whether the radius should be fixed or depend onradius_field
radius_field::Symbol = :null
: the name of the column oftable
that should be used for the radius of the pointsradius_range = [5.0, 15.0]
: range of the radii of the pointsradius_scale = "sqrt"
: how to mapradius_field
into the radiusopacity = 1.0
: opacity of the points, between0.0
and1.0
Examples
using Random, Colors
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
rng = MersenneTwister(12345)
df.icon = rand(rng, ["circle", "plus", "delete"], length(df.Latitude))
KeplerGL.add_icon_layer!(m, df, :Latitude, :Longitude, :icon; color = colorant"black");
H3 Layers
KeplerGLBase.add_h3_layer!
— Functionadd_h3_layer!(m::KeplerGLMap, table, h3::Symbol;
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantile",
color_aggregation = "average",
highlight_color = colorant"#762A83",
radius = 0.6,
coverage = 0.95,
resolution = 8,
opacity = 1.0,
height_field::Symbol = :null,
height_scale = "sqrt",
coverage_range = [0,1],
height_aggregation = "average",
elevation_percentile = [0,100],
elevation_scale = 5,
enable_elevation_zoom_factor = true,
enable_3d = false)
Adds a H3 layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromh3::Symbol
: name of the column oftable
that contains the H3 index
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the hexagons should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the hexagonscolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.coverage = 0.95
: fraction of the hexagon area that should be coveredopacity = 1.0
: opacity of the hexagons, between0.0
and1.0
height_field::Symbol = :null
: name of the column oftable
that should be used to determine the height of the hexagonsheight_scale = "sqrt"
: howheight_field
should be converted into the actual heightheight_range = [0,500]
: range of the height of columnscoverage_field = :null
: name of the column oftable
that should be used to determine the coverage of hexagonscoverage_scale = "linear"
: howcoverage_field
should be converted into the actual coveragecoverage_range = [0,1]
: range of the coverageelevation_scale = 5
: scaling factor for the heightenable_elevation_zoom_factor = true
enable_3d = false
: nable 3d on the layer
Examples
using H3, H3.API
m = KeplerGL.KeplerGLMap(token)
df = CSV.read("assets/example_data/data.csv", DataFrame)
coord = H3.Lib.GeoCoord.(deg2rad.(df.Latitude), deg2rad.(df.Longitude) )
h3 = H3.API.geoToH3.(coord, 5)
df.h3str = H3.API.h3ToString.(h3)
KeplerGL.add_h3_layer!(m, df, :h3str,
color = colorant"rgb(23,184,190)", color_field = :Magnitude, color_scale = "quantize",
color_range = ColorBrewer.palette("PRGn", 6));
Trip Layers
KeplerGLBase.add_trip_layer!
— Functionadd_trip_layer!(m::KeplerGLMap, table, geojson::Symbol;
m::KeplerGLMap, table, geojson::Symbol;
id::String = randstring(7),
color = colorant"#762A83",
color_field::Symbol = :null,
color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"],
color_scale = "quantize",
highlight_color = colorant"#762A83",
trail_length = 180,
opacity = 1.0,
outline_thickness = 2.0,
outline_width_field::Symbol = :null,
outline_width_scale = "linear",
outline_width_range = [0,10])
Adds a polygon layer to the map m
, drawing data from table
.
Required Arguments
m::KeplerGLMap
: the map that the layer should be added totable
: aTables.jl
-compatible table that contains the data to draw fromgeojson::Symbol
: name of the column oftable
that contains the trip in GeoJSON format (asLineString
, see here)
Optional Arguments
id = randstring(7)
: the string id of the layercolor = colorant"#762A83"
: aColors.jl
-compatible color that the shapes should have (if fixed)color_field::Symbol = :null
: the name of the column oftable
that should be used to color the shapescolor_range
: a vector ofColors.jl
-compatible colors. Usecolorant"xyz"
to generate.color_scale = "quantize"
: either"quantize"
or"quantile"
depending on whether values or quantiles should be used for the color.highlight_color = colorant"#762A83"
: highlight color.trail_length = 180
: number of seconds it takes for the path to fade out.opacity = 1.0
: opacity of the points, between0.0
and1.0
outline_thickness = 2.0
: thickness of the outlineoutline_width_field::Symbol = :null
: name of the column oftable
that should be used to determine the width of the polygon outlineoutline_width_scale = "linear"
: how the values inoutline_width_field
should be converted into the with of the outline
The trip layer is showing a dynamic visualization of the trips, so exporting the map as a static image is not very meaningful.
Examples
using JSON3
t = JSON3.read("assets/example_data/trip_example.geojson")
df = DataFrame(:geometry => string.(t[:features]))
m = KeplerGL.KeplerGLMap(token)
KeplerGL.add_trip_layer!(m, df, :geometry ,
id = "abc", color = colorant"red")
KeplerGL.render(m)