Type and Function Reference

KeplerGLBase.add_arc_layer!Method
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
KeplerGLBase.add_cluster_layer!Method
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
KeplerGLBase.add_grid_layer!Method
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
KeplerGLBase.add_h3_layer!Method
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
KeplerGLBase.add_heatmap_layer!Method
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
KeplerGLBase.add_hexagon_layer!Method
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
KeplerGLBase.add_icon_layer!Method
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
KeplerGLBase.add_line_layer!Method
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
KeplerGLBase.add_point_layer!Method
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
KeplerGLBase.add_polygon_layer!Method
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
KeplerGLBase.add_trip_layer!Method
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
KeplerGLBase.get_htmlMethod
get_html(m::KeplerGLMap)

Gets the html + js code to render the map in Blink

Required Arguments

  • m::KeplerGLMap: the map to get the HTML code for.
source
KeplerGLBase.get_jsonMethod
get_json(m::KeplerGLMap)

Returns the map in JSON format, which is also the format which Kepler.gl uses intrinsically to save map files.

Required Arguments

  • m::KeplerGLMap: the map of which the JSON code should be returned.
source
KeplerGLBase.hide_buttons!Method
hide_buttons!(m::KeplerGLMap)

Hides all buttons (legend, 3d, etc) on the top right corner of a KeplerGLMap

Required Arguments

  • m::KeplerGLMap: the map that should be affected
source
KeplerGLBase.hide_legend!Method
hide_legend!(m::KeplerGLMap)

Hides the legend on the top right corner of a KeplerGLMap

Required Arguments

  • m::KeplerGLMap: the map that should be affected
source
KeplerGLBase.load_config_from_json!Method
load_config_from_json!(m::KeplerGLMap, json_map_file::String)

Loads the config from a json file json_map_file and applies it to the map m.

Required Arguments

  • m::KeplerGLMap: the map to which the config should be applied.
  • json_map_file::String: the path to the JSON file from which the config should be loaded.
source
KeplerGLBase.load_map_from_json!Method
load_map_from_json!(m::KeplerGLMap, json_map_file::String)

Loads a kepler.gl map file from json_map_file into the map m. Overwrites any existing map config and datasets.

Required Arguments

  • m::KeplerGLMap: the map to which the config and data should be applied.
  • json_map_file::String: the path to the kepler.gl JSON map file.
source
KeplerGLBase.load_map_from_jsonMethod
load_map_from_json(token::String, json_map_file::String)

Returns a KeplerGLMap whose data and config has been loaded from json_map_file.

Required Arguments

  • token::String: mapbox token to use with the map.
  • json_map_file::String: the path to the Kepler.gl map JSON file which should be loaded.
source
KeplerGLBase.make_dispatch_codeMethod
make_dispatch_code(m::KeplerGLMap)

This function makes the dispatch code for m. It is called by render() but is sometimes also useful to call directly for debugging purposes

Required Arguments

  • m::KeplerGLMap: the map of which the dispatch code should be returned.
source
KeplerGLBase.FieldsRowsDataType
struct FieldsRowsData <: AbstractKeplerGLData
    id::String
    json::String
end

Concrete type for AbstractKeplerGLData, which contains data in the fields-rows format that Kepler.gl uses natively. Used for data that is loaded from KeplerGL maps in JSON format.

source
KeplerGLBase.KeplerGLMapType
mutable struct KeplerGLMap 
    datasets::Vector{AbstractKeplerGLData}
    config::Dict{Symbol, Any}
    info::Dict{Symbol, Any}
    window::Dict{Symbol, Any}
end

Type that contains all the information to render a map. config and info are of the same structure as the map JSON serialization that Kepler.gl uses internally. datasets are instances of AbstractKeplerGLData that contain the data that the layers draw from. window is additional information not used by Kepler.gl that contains information on window size, whether the map should be centered, and so on.

source
KeplerGLBase.KeplerGLMapMethod
KeplerGLMap(token::String;
    width::Int64 = 1200,
    height::Int64 = 900,
    center_map = true,
    read_only = false,
    config = KeplerGLBase.make_static_config())

Creates a new KeplerGLMap.

Required Arguments

  • token::String: the mapbox token to be used for displaying the map.

Optional Arguments

  • width:Int64 = 1200: width of the map window
  • height:Int64 = 900: height of the map window
  • center_map - true: whether the map should automatically be centered
  • read_only = false: whether the map should be read-only (not editable)
  • config = KeplerGLBase.make_static_config(): initial configuration
source
KeplerGL.export_imageMethod
export_image(window,filename; 
    width = 1000, height = 800,
    imageDataUri = "data:image/png;base64,2i3u")

Exports an image from window to filename of the format specified by imageDataUri.

Required Arguments

  • window: the window whose current state should be exported. This is returned by render().
  • filename: path to the file to be saved.
  • width: width of the exported image, in pixels.
  • height: height of the exported image, in pixels.
  • imageDataUri = "data:image/png;base64,2i3u": export image data uri. For JPG, choose "data:image/jpg;base64,".
source
KeplerGL.renderMethod
render(map::KeplerGLMap; show::Bool = true)

Renders a KeplerGLMap in a new Blink.jl window and returns this window.

Required Arguments

  • m::KeplerGLMap: the map that should be rendered

Optional Arguments

  • show::Bool = true: Dummy that specifies whether the window should be shown. Used in particular for testing.
source