Type and Function Reference
KeplerGLBase.add_arc_layer!
— Methodadd_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)
KeplerGLBase.add_cluster_layer!
— Methodadd_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" )
KeplerGLBase.add_grid_layer!
— Methodadd_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 )
KeplerGLBase.add_h3_layer!
— Methodadd_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));
KeplerGLBase.add_heatmap_layer!
— Methodadd_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) )
KeplerGLBase.add_hexagon_layer!
— Methodadd_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 )
KeplerGLBase.add_icon_layer!
— Methodadd_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");
KeplerGLBase.add_line_layer!
— Methodadd_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)
KeplerGLBase.add_point_layer!
— Methodadd_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);
KeplerGLBase.add_polygon_layer!
— Methodadd_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)
KeplerGLBase.add_trip_layer!
— Methodadd_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)
KeplerGLBase.get_html
— Methodget_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.
KeplerGLBase.get_json
— Methodget_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.
KeplerGLBase.hide_buttons!
— Methodhide_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
KeplerGLBase.hide_legend!
— Methodhide_legend!(m::KeplerGLMap)
Hides the legend on the top right corner of a KeplerGLMap
Required Arguments
m::KeplerGLMap
: the map that should be affected
KeplerGLBase.load_config_from_json!
— Methodload_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.
KeplerGLBase.load_map_from_json!
— Methodload_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.
KeplerGLBase.load_map_from_json
— Methodload_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.
KeplerGLBase.make_dispatch_code
— Methodmake_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.
KeplerGLBase.AbstractKeplerGLData
— Typeabstract type AbstractKeplerGLData end
Abstract type for datasets.
KeplerGLBase.CSVData
— Typestruct CSVData <: AbstractKeplerGLData
id::String
csvstring::String
end
Concrete type for AbstractKeplerGLData
, which contains data in CSV format. Used also when bringing data in via a DataFrame
.
KeplerGLBase.FieldsRowsData
— Typestruct 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.
KeplerGLBase.GeoJSONData
— Typestruct GeoJSONData <: AbstractKeplerGLData
id::String
json::String
end
Concrete type for AbstractKeplerGLData
, which contains data in GeoJSON format.
KeplerGLBase.KeplerGLMap
— Typemutable 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.
KeplerGLBase.KeplerGLMap
— MethodKeplerGLMap(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 windowheight:Int64 = 900
: height of the map windowcenter_map - true
: whether the map should automatically be centeredread_only = false
: whether the map should be read-only (not editable)config = KeplerGLBase.make_static_config()
: initial configuration
KeplerGL.export_image
— Methodexport_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 byrender()
.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,"
.
KeplerGL.render
— Methodrender(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.