Layers

Point Layers

KeplerGLBase.add_point_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude::Symbol: name of the column of table that contains the latitude of the points
  • longitude::Symbol: name of the column of table that contains the longitude of the points

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the points should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the points
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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 of table that should be used for the altitude of the points
  • radius = 10.0: fixed radius value of the points on the map
  • radius_fixed = true: whether the radius should be fixed or depend on radius_field
  • radius_field::Symbol = :null: the name of the column of table that should be used for the radius of the points
  • radius_range = [5.0, 15.0]: range of the radii of the points
  • radius_scale = "sqrt": how to map radius_field into the radius
  • filled = true: whether the point markers should be filled or not
  • opacity = 1.0: opacity of the points, between 0.0 and 1.0
  • outline = false: whether the point markers should have an outline
  • outline_thickness = 2.0: thickness of the outline
  • outline_color = colorant"#000000": a Colors.jl-compatible color that the point outlines should have (if fixed)
  • outline_color_field::Symbol = :null: the name of the column of table that should be used to color the point outlines
  • outline_color_range = [colorant"#FFFFFF", colorant"#000000"]: a vector of Colors.jl-compatible colors for the outlines. Use colorant"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);
source

Polygon Layers

KeplerGLBase.add_polygon_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • geojson::Symbo: name of the column of table that contains the feature in GeoJSON format

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the shapes should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the shapes
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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, between 0.0 and 1.0
  • outline = false: whether the point markers should have an outline
  • outline_thickness = 2.0: thickness of the outline
  • outline_color = colorant"#000000": a Colors.jl-compatible color that the point outlines should have (if fixed)
  • outline_color_field::Symbol = :null: the name of the column of table that should be used to color the point outlines
  • outline_color_range = [colorant"#FFFFFF", colorant"#000000"]: a vector of Colors.jl-compatible colors for the outlines. Use colorant"xyz" to generate.
  • outline_color_scale = "quantile": either "quantize" or "quantile" depending on whether values or quantiles should be used for the outline color
  • outline_width_field::Symbol = :null: name of the column of table that should be used to determine the width of the polygon outline
  • outline_width_scale = "linear": how the values in outline_width_field should be converted into the with of the outline
  • height_field::Symbol = :null: name of the column of table that should be used to determine the height of the feature
  • height_scale = "linear": how height_field should be converted into the actual height
  • elevation_scale = 1.0: scaling factor for the height
  • enable_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)
source

Hexbin Layers

KeplerGLBase.add_hexagon_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude::Symbol: name of the column of table that contains the latitude of the points to be aggregated into the hexbin
  • longitude::Symbol: name of the column of table that contains the longitude of the points to be aggregated into the hexbin

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the hexagons should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the hexagons
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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 map
  • coverage = 0.95: fraction of the hexagon area that should be covered
  • resolution = 8
  • opacity = 1.0: opacity of the hexagons, between 0.0 and 1.0
  • height_field::Symbol = :null: name of the column of table that should be used to determine the height of the hexagons
  • height_scale = "sqrt": how height_field should be converted into the actual height
  • height_percentile = [0,100]:
  • height_aggregation = "average":
  • height_range = [0,500]: range of the height of columns
  • elevation_percentile = [0,100]:
  • elevation_scale = 5: scaling factor for the height
  • enable_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 )
source

Line Layers

KeplerGLBase.add_line_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude0::Symbol: name of the column of table that contains the latitude of the origin of the line
  • longitude0::Symbol: name of the column of table that contains the longitude of the origin of the line
  • latitude1::Symbol: name of the column of table that contains the latitude of the endpoint of the line
  • longitude1::Symbol: name of the column of table that contains the longitude of the endpoint of the line

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the lines should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the lines
  • color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"]: a vector of Colors.jl-compatible colors. Use colorant"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 of table that should be used for the line thickness
  • size_range = [1,10]: thickness range of the lines
  • size_scale = "linear": how size_field should be converted into the actual line thickness
  • opacity = 1.0: opacity of the lines
  • thickness = 2.0: line thickness, if constant
  • elevation_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)
source

Arc Layers

KeplerGLBase.add_arc_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude0::Symbol: name of the column of table that contains the latitude of the origin of the line
  • longitude0::Symbol: name of the column of table that contains the longitude of the origin of the line
  • latitude1::Symbol: name of the column of table that contains the latitude of the endpoint of the line
  • longitude1::Symbol: name of the column of table that contains the longitude of the endpoint of the line

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the lines should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the lines
  • color_range = [colorant"#762A83",colorant"#AF8DC3",colorant"#E7D4E8",colorant"#D9F0D3",colorant"#7FBF7B",colorant"#1B7837"]: a vector of Colors.jl-compatible colors. Use colorant"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 of table that should be used for the line thickness
  • size_range = [1,10]: thickness range of the lines
  • size_scale = "linear": how size_field should be converted into the actual line thickness
  • opacity = 1.0: opacity of the lines
  • thickness = 2.0: line thickness, if constant
  • elevation_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)
source

Grid Layers

KeplerGLBase.add_grid_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude::Symbol: name of the column of table that contains the latitude of the points to be aggregated into the hexbin
  • longitude::Symbol: name of the column of table that contains the longitude of the points to be aggregated into the hexbin

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the hexagons should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the hexagons
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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 map
  • coverage = 0.95: fraction of the hexagon area that should be covered
  • resolution = 8
  • opacity = 1.0: opacity of the hexagons, between 0.0 and 1.0
  • height_field::Symbol = :null: name of the column of table that should be used to determine the height of the hexagons
  • height_scale = "sqrt": how height_field should be converted into the actual height
  • height_percentile = [0,100]:
  • height_aggregation = "average":
  • elevation_percentile = [0,100]:
  • elevation_scale = 5: scaling factor for the height
  • enable_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 )
source

Heatmap Layers

KeplerGLBase.add_heatmap_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude::Symbol: name of the column of table that contains the latitude of the points to be aggregated into the hexbin
  • longitude::Symbol: name of the column of table that contains the longitude of the points to be aggregated into the hexbin

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the hexagons should have (if fixed)
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"xyz" to generate.
  • weight_field::Symbol = :null: the name of the column of table that should be used to weigh the heatmap
  • weight_scale = "linear": how the weight_field should be translated into weights
  • highlight_color = colorant"#762A83": highlight color.
  • radius = 10.0: kernel width of the heatmap
  • opacity = 1.0: opacity of the layer, between 0.0 and 1.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) )
source

Cluster Layers

KeplerGLBase.add_cluster_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude::Symbol: name of the column of table that contains the latitude of the points to be aggregated into the hexbin
  • longitude::Symbol: name of the column of table that contains the longitude of the points to be aggregated into the hexbin

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the hexagons should have (if fixed)
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"xyz" to generate.
  • color_field::Symbol = :null: the name of the column of table that should be used to color the cluster points
  • 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_range = [1,40]: range for the point radii
  • cluster_radius = 20: radius for the clustering
  • color_aggregation = "count": how to aggregate the color
  • opacity = 1.0: opacity of the layer, between 0.0 and 1.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" )
source

Icon Layers

KeplerGLBase.add_icon_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • latitude::Symbol: name of the column of table that contains the latitude of the points
  • longitude::Symbol: name of the column of table that contains the longitude of the points
  • icon::Symbol: name of the column of table 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 layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the points should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the points
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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 of table that should be used for the altitude of the points
  • radius = 10.0: fixed radius value of the points on the map
  • radius_fixed = true: whether the radius should be fixed or depend on radius_field
  • radius_field::Symbol = :null: the name of the column of table that should be used for the radius of the points
  • radius_range = [5.0, 15.0]: range of the radii of the points
  • radius_scale = "sqrt": how to map radius_field into the radius
  • opacity = 1.0: opacity of the points, between 0.0 and 1.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");
source

H3 Layers

KeplerGLBase.add_h3_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • h3::Symbol: name of the column of table that contains the H3 index

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the hexagons should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the hexagons
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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 covered
  • opacity = 1.0: opacity of the hexagons, between 0.0 and 1.0
  • height_field::Symbol = :null: name of the column of table that should be used to determine the height of the hexagons
  • height_scale = "sqrt": how height_field should be converted into the actual height
  • height_range = [0,500]: range of the height of columns
  • coverage_field = :null: name of the column of table that should be used to determine the coverage of hexagons
  • coverage_scale = "linear": how coverage_field should be converted into the actual coverage
  • coverage_range = [0,1]: range of the coverage
  • elevation_scale = 5: scaling factor for the height
  • enable_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));
source

Trip Layers

KeplerGLBase.add_trip_layer!Function
add_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 to
  • table: a Tables.jl-compatible table that contains the data to draw from
  • geojson::Symbol: name of the column of table that contains the trip in GeoJSON format (as LineString, see here)

Optional Arguments

  • id = randstring(7): the string id of the layer
  • color = colorant"#762A83": a Colors.jl-compatible color that the shapes should have (if fixed)
  • color_field::Symbol = :null: the name of the column of table that should be used to color the shapes
  • color_range: a vector of Colors.jl-compatible colors. Use colorant"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, between 0.0 and 1.0
  • outline_thickness = 2.0: thickness of the outline
  • outline_width_field::Symbol = :null: name of the column of table that should be used to determine the width of the polygon outline
  • outline_width_scale = "linear": how the values in outline_width_field should be converted into the with of the outline
Note

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)
source