TileProviders
A large collection of tile providers.
diff --git a/dev/404.html b/dev/404.html new file mode 100644 index 00000000..7f9690e5 --- /dev/null +++ b/dev/404.html @@ -0,0 +1,22 @@ + + +
+ + +ElevationProvider(color_provider::Union{Nothing, AbstractProvider}=TileProviders.Esri(:WorldImagery); cache_size_gb=5)
Provider rendering elevation data from arcgis. This provider is special, since it uses a second provider for color information, which also means you can provide a cache size, since color tile caching has to be managed by the provider. When set to nothing
, no color provider is used and the elevation data is used to color the surface with a colormap directly. Use Map(..., plot_config=Tyler.PlotConfig(colormap=colormap))
to set the colormap and other surface
plot attributes.
GeoTilePointCloudProvider(subset="AHN1_T")
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands. You can specify the subset to download from, which can be one of the following:
AHN1_T (default): The most corse dataset, but also the fastest to download (1-5mb compressed per tile)
AHN2_T: More detailed dataset (~70mb per tile)
AHN3_T: ~250mb per tile
AHN4_T: 300-500mb showing much detail, takes a long time to load each tile (over 1 minute per tile). Use max_plots=5
to limit the number of tiles loaded at once.
Interpolator <: AbstractProvider
+
+Interpolator(f; colormap=:thermal, options=Dict(:minzoom=1, :maxzoom=19))
Provides tiles by interpolating them on the fly.
f
: an Interpolations.jl interpolator or similar.
colormap
: A Symbol
or Vector{RGBA{Float32}}
. Default is :thermal
.
Map(extent, [extent_crs=wgs84]; kw...)
+Map(map::Map; ...) # layering another provider on top of an existing map
Tylers main object, it plots tiles onto a Makie.jl Axis
, downloading and plotting more tiles as you zoom and pan. When layering providers over each other with Map(map::Map; ...)
, you can use toggle_visibility!(map)
to hide/unhide them.
Arguments
-extent
: the initial extent of the map, as a GeometryBasics.Rect
or an Extents.Extent
in the projection of extent_crs
. -extent_crs
: Any GeoFormatTypes
compatible crs, the default is wsg84.
Keywords
-size
: The figure size. -figure
: an existing Makie.Figure
object. -crs
: The providers coordinate reference system. -provider
: a TileProviders.jl Provider
. -max_parallel_downloads
: limits the attempted simultaneous downloads, with a default of 16
. -cache_size_gb
: limits the cache for storing tiles, with a default of 5
. -fetching_scheme=Halo2DTiling()
: The tile fetching scheme. Can be SimpleTiling(), Halo2DTiling(), or Tiling3D(). -scale
: a tile scaling factor. Low number decrease the downloads but reduce the resolution. The default is 0.5
. -plot_config
: A PlotConfig
object to change the way tiles are plotted. -max_zoom
: The maximum zoom level to display, with a default of TileProviders.max_zoom(provider)
. -max_plots=400:
The maximum number of plots to keep displayed at the same time.
Map(m::Map; kw...)
Layering constructor to show another provider on top of an existing map.
Example
lat, lon = (52.395593, 4.884704)
+delta = 0.01
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+m1 = Tyler.Map(ext)
+m2 = Tyler.Map(m1; provider=TileProviders.Esri(:WorldImagery), plot_config=Tyler.PlotConfig(alpha=0.5, postprocess=(p-> translate!(p, 0, 0, 1f0))))
+m1
PlotConfig(; preprocess=identity, postprocess=identity, plot_attributes...)
Creates a PlotConfig
object to influence how tiles are being plotted.
preprocess(tile_data): Function to preprocess the data before plotting. For a tile provider returning image data, preprocess will be called on the image data before plotting.
postprocess(tile_data): Function to mutate the plot object after creation. Can be used like this: (plot)-> translate!(plot, 0, 0, 1)
.
plot_attributes: Additional attributes to pass to the plot
Example
using Tyler, GLMakie
+
+config = PlotConfig(
+ preprocess = (data) -> data .+ 1,
+ postprocess = (plot) -> translate!(plot, 0, 0, 1),
+ color = :red
+)
+lat, lon = (52.395593, 4.884704)
+delta = 0.1
+extent = Extent(; X=(lon - delta / 2, lon + delta / 2), Y=(lat - delta / 2, lat + delta / 2))
+Tyler.Map(extent; provider=Tyler.TileProviders.Esri(:WorldImagery), plot_config=config)
ElevationProvider(color_provider::Union{Nothing, AbstractProvider}=TileProviders.Esri(:WorldImagery); cache_size_gb=5)
Provider rendering elevation data from arcgis. This provider is special, since it uses a second provider for color information, which also means you can provide a cache size, since color tile caching has to be managed by the provider. When set to nothing
, no color provider is used and the elevation data is used to color the surface with a colormap directly. Use Map(..., plot_config=Tyler.PlotConfig(colormap=colormap))
to set the colormap and other surface
plot attributes.
GeoTilePointCloudProvider(subset="AHN1_T")
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands. You can specify the subset to download from, which can be one of the following:
AHN1_T (default): The most corse dataset, but also the fastest to download (1-5mb compressed per tile)
AHN2_T: More detailed dataset (~70mb per tile)
AHN3_T: ~250mb per tile
AHN4_T: 300-500mb showing much detail, takes a long time to load each tile (over 1 minute per tile). Use max_plots=5
to limit the number of tiles loaded at once.
Interpolator <: AbstractProvider
+
+Interpolator(f; colormap=:thermal, options=Dict(:minzoom=1, :maxzoom=19))
Provides tiles by interpolating them on the fly.
f
: an Interpolations.jl interpolator or similar.
colormap
: A Symbol
or Vector{RGBA{Float32}}
. Default is :thermal
.
Map(extent, [extent_crs=wgs84]; kw...)
+Map(map::Map; ...) # layering another provider on top of an existing map
Tylers main object, it plots tiles onto a Makie.jl Axis
, downloading and plotting more tiles as you zoom and pan. When layering providers over each other with Map(map::Map; ...)
, you can use toggle_visibility!(map)
to hide/unhide them.
Arguments
-extent
: the initial extent of the map, as a GeometryBasics.Rect
or an Extents.Extent
in the projection of extent_crs
. -extent_crs
: Any GeoFormatTypes
compatible crs, the default is wsg84.
Keywords
-size
: The figure size. -figure
: an existing Makie.Figure
object. -crs
: The providers coordinate reference system. -provider
: a TileProviders.jl Provider
. -max_parallel_downloads
: limits the attempted simultaneous downloads, with a default of 16
. -cache_size_gb
: limits the cache for storing tiles, with a default of 5
. -fetching_scheme=Halo2DTiling()
: The tile fetching scheme. Can be SimpleTiling(), Halo2DTiling(), or Tiling3D(). -scale
: a tile scaling factor. Low number decrease the downloads but reduce the resolution. The default is 0.5
. -plot_config
: A PlotConfig
object to change the way tiles are plotted. -max_zoom
: The maximum zoom level to display, with a default of TileProviders.max_zoom(provider)
. -max_plots=400:
The maximum number of plots to keep displayed at the same time.
Map(m::Map; kw...)
Layering constructor to show another provider on top of an existing map.
Example
lat, lon = (52.395593, 4.884704)
+delta = 0.01
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+m1 = Tyler.Map(ext)
+m2 = Tyler.Map(m1; provider=TileProviders.Esri(:WorldImagery), plot_config=Tyler.PlotConfig(alpha=0.5, postprocess=(p-> translate!(p, 0, 0, 1f0))))
+m1
PlotConfig(; preprocess=identity, postprocess=identity, plot_attributes...)
Creates a PlotConfig
object to influence how tiles are being plotted.
preprocess(tile_data): Function to preprocess the data before plotting. For a tile provider returning image data, preprocess will be called on the image data before plotting.
postprocess(tile_data): Function to mutate the plot object after creation. Can be used like this: (plot)-> translate!(plot, 0, 0, 1)
.
plot_attributes: Additional attributes to pass to the plot
Example
using Tyler, GLMakie
+
+config = PlotConfig(
+ preprocess = (data) -> data .+ 1,
+ postprocess = (plot) -> translate!(plot, 0, 0, 1),
+ color = :red
+)
+lat, lon = (52.395593, 4.884704)
+delta = 0.1
+extent = Extent(; X=(lon - delta / 2, lon + delta / 2), Y=(lat - delta / 2, lat + delta / 2))
+Tyler.Map(extent; provider=Tyler.TileProviders.Esri(:WorldImagery), plot_config=config)
A package for downloading map tiles on demand from different data source providers.
This package is currently in the initial phase of development. It needs support. Sponsorships are welcome!
In the Julia REPL type:
] add Tyler
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
Or, explicitly use Pkg
using Pkg
+Pkg.add(["Tyler.jl"])
using Tyler, GLMakie
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
INFO
A Rect2f
definition takes as input the origin, first two entries, and the width and hight, last two numbers.
We can use a different tile provider as well as any style theme
from Makie as follows:
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenStreetMap(:Mapnik)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ m = Tyler.Map(london; provider)
+ hidedecorations!(m.axis)
+ hidespines!(m.axis)
+ m
+end
More providers are available. See the following list:
providers = TileProviders.list_providers()
Dict{Function, Vector{Symbol}} with 40 entries:
+ FreeMapSK => []
+ NLS => [:osgb63k1885, :osgb1888, :osgb10k1888, :osgb1919, :…
+ OpenRailwayMap => []
+ MtbMap => []
+ TomTom => [:Basic, :Hybrid, :Labels]
+ HEREv3 => [:normalDay, :normalDayCustom, :normalDayGrey, :norm…
+ OPNVKarte => []
+ CartoDB => [:Positron, :PositronNoLabels, :PositronOnlyLabels, …
+ JusticeMap => [:income, :americanIndian, :asian, :black, :hispanic…
+ WaymarkedTrails => [:hiking, :cycling, :mtb, :slopes, :riding, :skating]
+ AzureMaps => [:MicrosoftImagery, :MicrosoftBaseDarkGrey, :Microso…
+ HikeBike => [:HikeBike, :HillShading]
+ OpenSeaMap => []
+ nlmaps => [:standaard, :pastel, :grijs, :water, :luchtfoto]
+ GeoportailFrance => [:plan, :parcels, :orthos]
+ NASAGIBS => [:ModisTerraTrueColorCR, :ModisTerraBands367CR, :Vii…
+ OpenTopoMap => []
+ SwissFederalGeoportal => [:NationalMapColor, :NationalMapGrey, :SWISSIMAGE]
+ CyclOSM => []
+ ⋮ => ⋮
INFO
For some providers additional configuration steps are necessary, look at the TileProviders.jl
documentation for more information.
Although, the figure size can be controlled by passing additional arguments to Map
, it's better to define a Figure first and then continue with a normal Makie's figure creation workflow, namely
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenTopoMap()
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ fig = Figure(; size =(1200,600))
+ ax = Axis(fig[1,1]) # aspect = DataAspect()
+ m = Tyler.Map(london; provider, figure=fig, axis=ax)
+ wait(m)
+ hidedecorations!(ax)
+ hidespines!(ax)
+ fig
+end
Next, we could add any other plot type on top of the ax
axis defined above.
A package for downloading map tiles on demand from different data source providers.
This package is currently in the initial phase of development. It needs support. Sponsorships are welcome!
In the Julia REPL type:
] add Tyler
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
Or, explicitly use Pkg
using Pkg
+Pkg.add(["Tyler.jl"])
using Tyler, GLMakie
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
INFO
A Rect2f
definition takes as input the origin, first two entries, and the width and hight, last two numbers.
We can use a different tile provider as well as any style theme
from Makie as follows:
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenStreetMap(:Mapnik)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ m = Tyler.Map(london; provider)
+ hidedecorations!(m.axis)
+ hidespines!(m.axis)
+ m
+end
More providers are available. See the following list:
providers = TileProviders.list_providers()
Dict{Function, Vector{Symbol}} with 40 entries:
+ FreeMapSK => []
+ NLS => [:osgb63k1885, :osgb1888, :osgb10k1888, :osgb1919, :…
+ OpenRailwayMap => []
+ MtbMap => []
+ TomTom => [:Basic, :Hybrid, :Labels]
+ HEREv3 => [:normalDay, :normalDayCustom, :normalDayGrey, :norm…
+ OPNVKarte => []
+ CartoDB => [:Positron, :PositronNoLabels, :PositronOnlyLabels, …
+ JusticeMap => [:income, :americanIndian, :asian, :black, :hispanic…
+ WaymarkedTrails => [:hiking, :cycling, :mtb, :slopes, :riding, :skating]
+ AzureMaps => [:MicrosoftImagery, :MicrosoftBaseDarkGrey, :Microso…
+ HikeBike => [:HikeBike, :HillShading]
+ OpenSeaMap => []
+ nlmaps => [:standaard, :pastel, :grijs, :water, :luchtfoto]
+ GeoportailFrance => [:plan, :parcels, :orthos]
+ NASAGIBS => [:ModisTerraTrueColorCR, :ModisTerraBands367CR, :Vii…
+ OpenTopoMap => []
+ SwissFederalGeoportal => [:NationalMapColor, :NationalMapGrey, :SWISSIMAGE]
+ CyclOSM => []
+ ⋮ => ⋮
INFO
For some providers additional configuration steps are necessary, look at the TileProviders.jl
documentation for more information.
Although, the figure size can be controlled by passing additional arguments to Map
, it's better to define a Figure first and then continue with a normal Makie's figure creation workflow, namely
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenTopoMap()
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ fig = Figure(; size =(1200,600))
+ ax = Axis(fig[1,1]) # aspect = DataAspect()
+ m = Tyler.Map(london; provider, figure=fig, axis=ax)
+ wait(m)
+ hidedecorations!(ax)
+ hidespines!(ax)
+ fig
+end
Next, we could add any other plot type on top of the ax
axis defined above.
using Tyler
+using Tyler.TileProviders
+using Tyler.Extents
+using Dates
+using HTTP
+using Arrow
+using DataFrames
+using GLMakie
+using GLMakie.Colors
+GLMakie.activate!()
INFO
Ice loss from the Greenland Ice Sheet: 1972-2022.
Load ice loss data [courtesy of Chad Greene @ JPL]
url = "https://github.com/JuliaGeo/JuliaGeoData/blob/365a09596bfca59e0977c20c2c2f566c0b29dbaa/assets/data/iceloss_subset.arrow?raw=true";
+resp = HTTP.get(url);
+df = DataFrame(Arrow.Table(resp.body));
+first(df, 5)
select map provider
provider = TileProviders.Esri(:WorldImagery);
Greenland extent
extent = Extent(X = (-54., -48.), Y = (68.8, 72.5));
Extent(X = (-54.0, -48.0), Y = (68.8, 72.5))
extract data
cnt = [length(foo) for foo in df.X];
+X = reduce(vcat,df.X);
+Y = reduce(vcat,df.Y);
+Z = [repeat([i],c) for (i, c) = enumerate(cnt)];
+Z = reduce(vcat,Z);
make a colormap
nc = length(Makie.to_colormap(:thermal));
+n = nrow(df);
+alpha = zeros(nc);
+alpha[1:maximum([1,round(Int64,1*nc/n)])] = alpha[1:maximum([1,round(Int64,1*nc/n)])] .* (1.05^-1.5);
+alpha[maximum([1,round(Int64,1*nc/n)])] = 1;
+cmap = Colors.alphacolor.(Makie.to_colormap(:thermal), alpha);
+cmap = Observable(cmap);
show map
fig = Figure(; size = (1200,600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(extent; provider, figure=fig, axis=ax)
create initial scatter plot
scatter!(ax, X, Y; color = Z, colormap = cmap, colorrange = [0, n], markersize = 10);
+m
add colorbar
a,b = extrema(df.Date);
+a = year(a);
+b = year(b);
+Colorbar(fig[1,2]; colormap = cmap, colorrange = [a,b],
+ height=Relative(0.5), width = 15)
+# hide ticks, grid and lables
+hidedecorations!(ax);
+# hide frames
+hidespines!(ax);
+m
loop to create animation
for k = 1:15
+ # reset apha
+ alpha[:] = zeros(nc);
+ cmap[] = Colors.alphacolor.(cmap[], alpha)
+ for i in 2:1:n
+ # modify alpha
+ alpha[1:maximum([1,round(Int64,i*nc/n)])] = alpha[1:maximum([1,round(Int64,i*nc/n)])] .* (1.05^-1.5);
+ alpha[maximum([1,round(Int64,i*nc/n)])] = 1;
+ cmap[] = Colors.alphacolor.(cmap[], alpha);
+ sleep(0.001);
+ end
+end
using Tyler
+using Tyler.TileProviders
+using Tyler.Extents
+using Dates
+using HTTP
+using Arrow
+using DataFrames
+using GLMakie
+using GLMakie.Colors
+GLMakie.activate!()
INFO
Ice loss from the Greenland Ice Sheet: 1972-2022.
Load ice loss data [courtesy of Chad Greene @ JPL]
url = "https://github.com/JuliaGeo/JuliaGeoData/blob/365a09596bfca59e0977c20c2c2f566c0b29dbaa/assets/data/iceloss_subset.arrow?raw=true";
+resp = HTTP.get(url);
+df = DataFrame(Arrow.Table(resp.body));
+first(df, 5)
select map provider
provider = TileProviders.Esri(:WorldImagery);
Greenland extent
extent = Extent(X = (-54., -48.), Y = (68.8, 72.5));
Extent(X = (-54.0, -48.0), Y = (68.8, 72.5))
extract data
cnt = [length(foo) for foo in df.X];
+X = reduce(vcat,df.X);
+Y = reduce(vcat,df.Y);
+Z = [repeat([i],c) for (i, c) = enumerate(cnt)];
+Z = reduce(vcat,Z);
make a colormap
nc = length(Makie.to_colormap(:thermal));
+n = nrow(df);
+alpha = zeros(nc);
+alpha[1:maximum([1,round(Int64,1*nc/n)])] = alpha[1:maximum([1,round(Int64,1*nc/n)])] .* (1.05^-1.5);
+alpha[maximum([1,round(Int64,1*nc/n)])] = 1;
+cmap = Colors.alphacolor.(Makie.to_colormap(:thermal), alpha);
+cmap = Observable(cmap);
show map
fig = Figure(; size = (1200,600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(extent; provider, figure=fig, axis=ax)
create initial scatter plot
scatter!(ax, X, Y; color = Z, colormap = cmap, colorrange = [0, n], markersize = 10);
+m
add colorbar
a,b = extrema(df.Date);
+a = year(a);
+b = year(b);
+Colorbar(fig[1,2]; colormap = cmap, colorrange = [a,b],
+ height=Relative(0.5), width = 15)
+# hide ticks, grid and lables
+hidedecorations!(ax);
+# hide frames
+hidespines!(ax);
+m
loop to create animation
for k = 1:15
+ # reset apha
+ alpha[:] = zeros(nc);
+ cmap[] = Colors.alphacolor.(cmap[], alpha)
+ for i in 2:1:n
+ # modify alpha
+ alpha[1:maximum([1,round(Int64,i*nc/n)])] = alpha[1:maximum([1,round(Int64,i*nc/n)])] .* (1.05^-1.5);
+ alpha[maximum([1,round(Int64,i*nc/n)])] = 1;
+ cmap[] = Colors.alphacolor.(cmap[], alpha);
+ sleep(0.001);
+ end
+end
INFO
Sine waves
using Tyler, GLMakie
+using Interpolations: interpolate, Gridded, Linear
+
+f(lon,lat)=cosd(16*lon)+sind(16*lat)
+
+f_in_0_1_range(lon,lat)=0.5+0.25*f(lon,lat)
+
+nodes=(-180.0:180.0, -90.0:90.0)
+
+array=[f(lon,lat) for lon in nodes[1], lat in nodes[2]]
+array=(array.-minimum(array))./(maximum(array)-minimum(array))
+
+itp = interpolate(nodes, array, Gridded(Linear()))
+cols=Makie.to_colormap(:viridis)
+
+col(i)=RGBAf(Makie.interpolated_getindex(cols,i))
+fun(x,y) = col(itp(x,y))
+
+options = Dict(:min_zoom => 1,:max_zoom => 19)
+
+p1 = Tyler.Interpolator(f_in_0_1_range; options)
+p2 = Tyler.Interpolator(fun; options)
+
+b = Rect2f(-20.0, -20.0, 40.0, 40.0)
+m = Tyler.Map(b, provider=p1)
TIP
Try b = Rect2f(-180.0, -89.9, 360.0, 179.8)
INFO
interpolated_getindex
requires input i
to be in the 0-1
range.
INFO
Sine waves
using Tyler, GLMakie
+using Interpolations: interpolate, Gridded, Linear
+
+f(lon,lat)=cosd(16*lon)+sind(16*lat)
+
+f_in_0_1_range(lon,lat)=0.5+0.25*f(lon,lat)
+
+nodes=(-180.0:180.0, -90.0:90.0)
+
+array=[f(lon,lat) for lon in nodes[1], lat in nodes[2]]
+array=(array.-minimum(array))./(maximum(array)-minimum(array))
+
+itp = interpolate(nodes, array, Gridded(Linear()))
+cols=Makie.to_colormap(:viridis)
+
+col(i)=RGBAf(Makie.interpolated_getindex(cols,i))
+fun(x,y) = col(itp(x,y))
+
+options = Dict(:min_zoom => 1,:max_zoom => 19)
+
+p1 = Tyler.Interpolator(f_in_0_1_range; options)
+p2 = Tyler.Interpolator(fun; options)
+
+b = Rect2f(-20.0, -20.0, 40.0, 40.0)
+m = Tyler.Map(b, provider=p1)
TIP
Try b = Rect2f(-180.0, -89.9, 360.0, 179.8)
INFO
interpolated_getindex
requires input i
to be in the 0-1
range.
Tyler also offers to view tiles in 3D, and offers a simple Elevation and PointCloud provider.
using Tyler, GLMakie
+using Tyler: ElevationProvider
+
+lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon-delta/2, lat-delta/2, delta, delta)
+m = Tyler.Map3D(ext; provider=ElevationProvider())
With PlotConfig one can change the way tiles are plotted. The it has a preprocess + postprocess function and allows to pass any plot attribute to the tile. These attributes are global and will be passed to every tile plot.
lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading, colorrange=(2000, 5000),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext; provider=ElevationProvider(nothing), plot_config=cfg)
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.03
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+m = Tyler.Map3D(ext; provider=provider)
There is also a MeshScatter plot config, which can be used to switch the point cloud plotting from scatter to meshscatter. This looks better, at a significant slow down.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.008
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+image = ElevationProvider(nothing)
+cfg = Tyler.MeshScatterPlotconfig()
+m1 = Tyler.Map3D(ext; provider=provider, plot_config=cfg)
+cfg = Tyler.PlotConfig(preprocess=pc -> map(p -> p .* 2, pc), shading=FastShading, colormap=:alpine)
+m2 = Tyler.Map3D(m1; provider=image, plot_config=cfg)
+m1
using RPRMakie, FileIO
+function render_rpr(m, name, radiance=1000000)
+ wait(m)
+ ax = m.axis
+ cam = ax.scene.camera_controls
+ lightpos = Vec3f(cam.lookat[][1], cam.lookat[][2], cam.eyeposition[][3])
+ lights = [
+ EnvironmentLight(1.5, load(RPR.assetpath("studio026.exr"))),
+ PointLight(lightpos, RGBf(radiance, radiance * 0.9, radiance * 0.9))
+ ]
+ empty!(ax.scene.lights)
+ append!(ax.scene.lights, lights)
+ save("$(name).png", ax.scene; plugin=RPR.Northstar, backend=RPRMakie, iterations=2000)
+end
+function plastic_material()
+ return (type=:Uber, reflection_color=Vec4f(1),
+ reflection_weight=Vec4f(1), reflection_roughness=Vec4f(0.1),
+ reflection_anisotropy=Vec4f(0), reflection_anisotropy_rotation=Vec4f(0),
+ reflection_metalness=Vec4f(0), reflection_ior=Vec4f(1.4), refraction_weight=Vec4f(0),
+ coating_weight=Vec4f(0), sheen_weight=Vec4f(0), emission_weight=Vec3f(0),
+ transparency=Vec4f(0), reflection_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR),
+ emission_mode=UInt(RPR.RPR_UBER_MATERIAL_EMISSION_MODE_SINGLESIDED),
+ coating_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR), sss_multiscatter=true,
+ refraction_thin_surface=true)
+end
lat, lon = (47.087441, 13.377214)
+delta = 0.5
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading,
+ material=plastic_material(),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext;
+ provider=ElevationProvider(nothing),
+ plot_config=cfg,
+ max_plots=5
+)
+render_rpr(m, "alpine", 10000000)
lat, lon = (52.40459835229174, 4.84763329882317)
+delta = 0.005
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+mat = (type=:Microfacet, roughness=0.2, ior=1.390)
+cfg = Tyler.MeshScatterPlotconfig(material=mat, markersize=4)
+m = Tyler.Map3D(ext; provider=provider, plot_config=cfg, max_plots=3, size=(2000, 2000))
+cfg = Tyler.PlotConfig(material=mat, colormap=:Blues)
+m2 = Tyler.Map3D(m; provider=ElevationProvider(nothing), plot_config=cfg, max_plots=5)
+render_rpr(m, "pointclouds")
+cp(Tyler)
Tyler also offers to view tiles in 3D, and offers a simple Elevation and PointCloud provider.
using Tyler, GLMakie
+using Tyler: ElevationProvider
+
+lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon-delta/2, lat-delta/2, delta, delta)
+m = Tyler.Map3D(ext; provider=ElevationProvider())
With PlotConfig one can change the way tiles are plotted. The it has a preprocess + postprocess function and allows to pass any plot attribute to the tile. These attributes are global and will be passed to every tile plot.
lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading, colorrange=(2000, 5000),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext; provider=ElevationProvider(nothing), plot_config=cfg)
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.03
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+m = Tyler.Map3D(ext; provider=provider)
There is also a MeshScatter plot config, which can be used to switch the point cloud plotting from scatter to meshscatter. This looks better, at a significant slow down.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.008
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+image = ElevationProvider(nothing)
+cfg = Tyler.MeshScatterPlotconfig()
+m1 = Tyler.Map3D(ext; provider=provider, plot_config=cfg)
+cfg = Tyler.PlotConfig(preprocess=pc -> map(p -> p .* 2, pc), shading=FastShading, colormap=:alpine)
+m2 = Tyler.Map3D(m1; provider=image, plot_config=cfg)
+m1
using RPRMakie, FileIO
+function render_rpr(m, name, radiance=1000000)
+ wait(m)
+ ax = m.axis
+ cam = ax.scene.camera_controls
+ lightpos = Vec3f(cam.lookat[][1], cam.lookat[][2], cam.eyeposition[][3])
+ lights = [
+ EnvironmentLight(1.5, load(RPR.assetpath("studio026.exr"))),
+ PointLight(lightpos, RGBf(radiance, radiance * 0.9, radiance * 0.9))
+ ]
+ empty!(ax.scene.lights)
+ append!(ax.scene.lights, lights)
+ save("$(name).png", ax.scene; plugin=RPR.Northstar, backend=RPRMakie, iterations=2000)
+end
+function plastic_material()
+ return (type=:Uber, reflection_color=Vec4f(1),
+ reflection_weight=Vec4f(1), reflection_roughness=Vec4f(0.1),
+ reflection_anisotropy=Vec4f(0), reflection_anisotropy_rotation=Vec4f(0),
+ reflection_metalness=Vec4f(0), reflection_ior=Vec4f(1.4), refraction_weight=Vec4f(0),
+ coating_weight=Vec4f(0), sheen_weight=Vec4f(0), emission_weight=Vec3f(0),
+ transparency=Vec4f(0), reflection_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR),
+ emission_mode=UInt(RPR.RPR_UBER_MATERIAL_EMISSION_MODE_SINGLESIDED),
+ coating_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR), sss_multiscatter=true,
+ refraction_thin_surface=true)
+end
lat, lon = (47.087441, 13.377214)
+delta = 0.5
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading,
+ material=plastic_material(),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext;
+ provider=ElevationProvider(nothing),
+ plot_config=cfg,
+ max_plots=5
+)
+render_rpr(m, "alpine", 10000000)
lat, lon = (52.40459835229174, 4.84763329882317)
+delta = 0.005
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+mat = (type=:Microfacet, roughness=0.2, ior=1.390)
+cfg = Tyler.MeshScatterPlotconfig(material=mat, markersize=4)
+m = Tyler.Map3D(ext; provider=provider, plot_config=cfg, max_plots=3, size=(2000, 2000))
+cfg = Tyler.PlotConfig(material=mat, colormap=:Blues)
+m2 = Tyler.Map3D(m; provider=ElevationProvider(nothing), plot_config=cfg, max_plots=5)
+render_rpr(m, "pointclouds")
+cp(Tyler)
In this example, we combine OpenStreetMap data, loading some roads and buildings and plotting them on top of a Tyler map.
using Tyler, Tyler.TileProviders
+using GLMakie, OSMMakie, LightOSM
+
+area = (
+ minlat = 51.50, minlon = -0.0921, # bottom left corner
+ maxlat = 51.52, maxlon = -0.0662 # top right corner
+)
+
+download_osm_network(:bbox; # rectangular area
+ area..., # splat previously defined area boundaries
+ network_type=:drive, # download motorways
+ save_to_file_location="london_drive.json"
+);
+
+osm = graph_from_file("london_drive.json";
+ graph_type=:light, # SimpleDiGraph
+ weight_type=:distance
+)
+
+download_osm_buildings(:bbox;
+ area...,
+ metadata=true,
+ download_format=:osm,
+ save_to_file_location="london_buildings.osm"
+);
+
+# load as Buildings Dict
+buildings = buildings_from_file("london_buildings.osm");
+# Google + OSM
+provider = TileProviders.Google(:satelite)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+m = Tyler.Map(london; provider=provider, crs=Tyler.wgs84)
+m.axis.aspect = map_aspect(area.minlat, area.maxlat)
+p = osmplot!(m.axis, osm; buildings)
+# DataInspector(m.axis) # this is broken/slow
+m
In this example, we combine OpenStreetMap data, loading some roads and buildings and plotting them on top of a Tyler map.
using Tyler, Tyler.TileProviders
+using GLMakie, OSMMakie, LightOSM
+
+area = (
+ minlat = 51.50, minlon = -0.0921, # bottom left corner
+ maxlat = 51.52, maxlon = -0.0662 # top right corner
+)
+
+download_osm_network(:bbox; # rectangular area
+ area..., # splat previously defined area boundaries
+ network_type=:drive, # download motorways
+ save_to_file_location="london_drive.json"
+);
+
+osm = graph_from_file("london_drive.json";
+ graph_type=:light, # SimpleDiGraph
+ weight_type=:distance
+)
+
+download_osm_buildings(:bbox;
+ area...,
+ metadata=true,
+ download_format=:osm,
+ save_to_file_location="london_buildings.osm"
+);
+
+# load as Buildings Dict
+buildings = buildings_from_file("london_buildings.osm");
+# Google + OSM
+provider = TileProviders.Google(:satelite)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+m = Tyler.Map(london; provider=provider, crs=Tyler.wgs84)
+m.axis.aspect = map_aspect(area.minlat, area.maxlat)
+p = osmplot!(m.axis, osm; buildings)
+# DataInspector(m.axis) # this is broken/slow
+m
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using Tyler.Extents
select a map provider
provider = TileProviders.Esri(:WorldImagery)
TileProviders.Provider("https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", Dict{Symbol, Any}(:url => "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", :attribution => "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", :variant => "World_Imagery", :name => "Esri.WorldImagery", :html_attribution => "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"))
define a point to plot on the map
# point location to add to map
+lat = 34.2013;
+lon = -118.1714;
-118.1714
convert to point in web_mercator
pts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))
2-element GeometryBasics.Point{2, Float32} with indices SOneTo(2):
+ -1.315478f7
+ 4.0558638f6
set how much area to map in degrees and define an Extent
for display in web_mercator
delta = 1
+extent = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta);
GeometryBasics.HyperRectangle{2, Float32}(Float32[-118.6714, 33.7013], Float32[1.0, 1.0])
show map
m = Tyler.Map(extent; provider, size=(1000, 600))
now plot a point, polygon and text on the map
objscatter = scatter!(m.axis, pts; color = :red,
+ marker = '⭐', markersize = 50)
+# hide ticks, grid and lables
+hidedecorations!(m.axis)
+# hide frames
+hidespines!(m.axis)
+# Plot a plygon on the map
+p1 = (lon-delta/8, lat-delta/8)
+p2 = (lon-delta/8, lat+delta/8)
+p3 = (lon+delta/8, lat+delta/8)
+p4 = (lon+delta/8, lat-delta/8)
+
+polyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))
+polyg = Point2f.(polyg)
+poly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)
+
+# Add text
+pts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))
+text!(pts2, text = "Basic Example"; fontsize = 30,
+ color = :darkblue, align = (:center, :center)
+ )
+m
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using Tyler.Extents
select a map provider
provider = TileProviders.Esri(:WorldImagery)
TileProviders.Provider("https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", Dict{Symbol, Any}(:url => "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", :attribution => "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", :variant => "World_Imagery", :name => "Esri.WorldImagery", :html_attribution => "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"))
define a point to plot on the map
# point location to add to map
+lat = 34.2013;
+lon = -118.1714;
-118.1714
convert to point in web_mercator
pts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))
2-element GeometryBasics.Point{2, Float32} with indices SOneTo(2):
+ -1.315478f7
+ 4.0558638f6
set how much area to map in degrees and define an Extent
for display in web_mercator
delta = 1
+extent = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta);
GeometryBasics.HyperRectangle{2, Float32}(Float32[-118.6714, 33.7013], Float32[1.0, 1.0])
show map
m = Tyler.Map(extent; provider, size=(1000, 600))
now plot a point, polygon and text on the map
objscatter = scatter!(m.axis, pts; color = :red,
+ marker = '⭐', markersize = 50)
+# hide ticks, grid and lables
+hidedecorations!(m.axis)
+# hide frames
+hidespines!(m.axis)
+# Plot a plygon on the map
+p1 = (lon-delta/8, lat-delta/8)
+p2 = (lon-delta/8, lat+delta/8)
+p3 = (lon+delta/8, lat+delta/8)
+p4 = (lon+delta/8, lat-delta/8)
+
+polyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))
+polyg = Point2f.(polyg)
+poly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)
+
+# Add text
+pts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))
+text!(pts2, text = "Basic Example"; fontsize = 30,
+ color = :darkblue, align = (:center, :center)
+ )
+m
The full stack of Makie's ecosystem works.
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using Downloads: download
Here, we will be using points that originally are in longitude and latitute, hence a function to transform those into the web_mercator projection is defined,
function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
and downloading and preparing the data is done next
url = "https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv"
+d = download(url)
+whale = CSV.read(d, DataFrame)
+lon = whale[!, :lon]
+lat = whale[!, :lat]
+steps = size(lon,1)
+points = to_web_mercator.(lon,lat)
+
+lomn, lomx = extrema(lon)
+lamn, lamx = extrema(lat)
+δlon = abs(lomn - lomx)
+δlat = abs(lamn - lamx)
INFO
Whale shark movements in Gulf of Mexico.
Then a provider and the initial map are set
provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+
+set_theme!(theme_dark())
+fig = Figure(; size = (1200, 600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(Rect2f(Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat));
+ provider, figure=fig, axis=ax)
nt = 30
+trail = CircularBuffer{Point2f}(nt)
+fill!(trail, points[1]) # add correct values to the circular buffer
+trail = Observable(trail) # make it an observable
+whale = Observable(points[1])
+
+c = to_color(:orangered)
+trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail
+
+objline = lines!(ax, trail; color = trailcolor, linewidth=3)
+objscatter = scatter!(ax, whale; markersize = 15, color = :orangered,
+ strokecolor=:white, strokewidth=1.5)
+hidedecorations!(ax)
+hidespines!(ax)
+m
The animation is done by updating the Observable values
record(fig, "whale_shark_128786.mp4") do io
+ for i in 2:steps
+ push!(trail[], points[i])
+ whale[] = points[i]
+ trail[] = trail[]
+ recordframe!(io) # record a new frame
+ end
+end
+set_theme!() # reset theme (default)
The full stack of Makie's ecosystem works.
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using Downloads: download
Here, we will be using points that originally are in longitude and latitute, hence a function to transform those into the web_mercator projection is defined,
function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
and downloading and preparing the data is done next
url = "https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv"
+d = download(url)
+whale = CSV.read(d, DataFrame)
+lon = whale[!, :lon]
+lat = whale[!, :lat]
+steps = size(lon,1)
+points = to_web_mercator.(lon,lat)
+
+lomn, lomx = extrema(lon)
+lamn, lamx = extrema(lat)
+δlon = abs(lomn - lomx)
+δlat = abs(lamn - lamx)
INFO
Whale shark movements in Gulf of Mexico.
Then a provider and the initial map are set
provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+
+set_theme!(theme_dark())
+fig = Figure(; size = (1200, 600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(Rect2f(Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat));
+ provider, figure=fig, axis=ax)
nt = 30
+trail = CircularBuffer{Point2f}(nt)
+fill!(trail, points[1]) # add correct values to the circular buffer
+trail = Observable(trail) # make it an observable
+whale = Observable(points[1])
+
+c = to_color(:orangered)
+trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail
+
+objline = lines!(ax, trail; color = trailcolor, linewidth=3)
+objscatter = scatter!(ax, whale; markersize = 15, color = :orangered,
+ strokecolor=:white, strokewidth=1.5)
+hidedecorations!(ax)
+hidespines!(ax)
+m
The animation is done by updating the Observable values
record(fig, "whale_shark_128786.mp4") do io
+ for i in 2:steps
+ push!(trail[], points[i])
+ whale[] = points[i]
+ trail[] = trail[]
+ recordframe!(io) # record a new frame
+ end
+end
+set_theme!() # reset theme (default)
ElevationProvider(color_provider::Union{Nothing, AbstractProvider}=TileProviders.Esri(:WorldImagery); cache_size_gb=5)
Provider rendering elevation data from arcgis. This provider is special, since it uses a second provider for color information, which also means you can provide a cache size, since color tile caching has to be managed by the provider. When set to nothing
, no color provider is used and the elevation data is used to color the surface with a colormap directly. Use Map(..., plot_config=Tyler.PlotConfig(colormap=colormap))
to set the colormap and other surface
plot attributes.
GeoTilePointCloudProvider(subset="AHN1_T")
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands. You can specify the subset to download from, which can be one of the following:
AHN1_T (default): The most corse dataset, but also the fastest to download (1-5mb compressed per tile)
AHN2_T: More detailed dataset (~70mb per tile)
AHN3_T: ~250mb per tile
AHN4_T: 300-500mb showing much detail, takes a long time to load each tile (over 1 minute per tile). Use max_plots=5
to limit the number of tiles loaded at once.
Interpolator <: AbstractProvider
+
+Interpolator(f; colormap=:thermal, options=Dict(:minzoom=1, :maxzoom=19))
Provides tiles by interpolating them on the fly.
f
: an Interpolations.jl interpolator or similar.
colormap
: A Symbol
or Vector{RGBA{Float32}}
. Default is :thermal
.
Map(extent, [extent_crs=wgs84]; kw...)
+Map(map::Map; ...) # layering another provider on top of an existing map
Tylers main object, it plots tiles onto a Makie.jl Axis
, downloading and plotting more tiles as you zoom and pan. When layering providers over each other with Map(map::Map; ...)
, you can use toggle_visibility!(map)
to hide/unhide them.
Arguments
-extent
: the initial extent of the map, as a GeometryBasics.Rect
or an Extents.Extent
in the projection of extent_crs
. -extent_crs
: Any GeoFormatTypes
compatible crs, the default is wsg84.
Keywords
-size
: The figure size. -figure
: an existing Makie.Figure
object. -crs
: The providers coordinate reference system. -provider
: a TileProviders.jl Provider
. -max_parallel_downloads
: limits the attempted simultaneous downloads, with a default of 16
. -cache_size_gb
: limits the cache for storing tiles, with a default of 5
. -fetching_scheme=Halo2DTiling()
: The tile fetching scheme. Can be SimpleTiling(), Halo2DTiling(), or Tiling3D(). -scale
: a tile scaling factor. Low number decrease the downloads but reduce the resolution. The default is 0.5
. -plot_config
: A PlotConfig
object to change the way tiles are plotted. -max_zoom
: The maximum zoom level to display, with a default of TileProviders.max_zoom(provider)
. -max_plots=400:
The maximum number of plots to keep displayed at the same time.
Map(m::Map; kw...)
Layering constructor to show another provider on top of an existing map.
Example
lat, lon = (52.395593, 4.884704)
+delta = 0.01
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+m1 = Tyler.Map(ext)
+m2 = Tyler.Map(m1; provider=TileProviders.Esri(:WorldImagery), plot_config=Tyler.PlotConfig(alpha=0.5, postprocess=(p-> translate!(p, 0, 0, 1f0))))
+m1
PlotConfig(; preprocess=identity, postprocess=identity, plot_attributes...)
Creates a PlotConfig
object to influence how tiles are being plotted.
preprocess(tile_data): Function to preprocess the data before plotting. For a tile provider returning image data, preprocess will be called on the image data before plotting.
postprocess(tile_data): Function to mutate the plot object after creation. Can be used like this: (plot)-> translate!(plot, 0, 0, 1)
.
plot_attributes: Additional attributes to pass to the plot
Example
using Tyler, GLMakie
+
+config = PlotConfig(
+ preprocess = (data) -> data .+ 1,
+ postprocess = (plot) -> translate!(plot, 0, 0, 1),
+ color = :red
+)
+lat, lon = (52.395593, 4.884704)
+delta = 0.1
+extent = Extent(; X=(lon - delta / 2, lon + delta / 2), Y=(lat - delta / 2, lat + delta / 2))
+Tyler.Map(extent; provider=Tyler.TileProviders.Esri(:WorldImagery), plot_config=config)
ElevationProvider(color_provider::Union{Nothing, AbstractProvider}=TileProviders.Esri(:WorldImagery); cache_size_gb=5)
Provider rendering elevation data from arcgis. This provider is special, since it uses a second provider for color information, which also means you can provide a cache size, since color tile caching has to be managed by the provider. When set to nothing
, no color provider is used and the elevation data is used to color the surface with a colormap directly. Use Map(..., plot_config=Tyler.PlotConfig(colormap=colormap))
to set the colormap and other surface
plot attributes.
GeoTilePointCloudProvider(subset="AHN1_T")
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands. You can specify the subset to download from, which can be one of the following:
AHN1_T (default): The most corse dataset, but also the fastest to download (1-5mb compressed per tile)
AHN2_T: More detailed dataset (~70mb per tile)
AHN3_T: ~250mb per tile
AHN4_T: 300-500mb showing much detail, takes a long time to load each tile (over 1 minute per tile). Use max_plots=5
to limit the number of tiles loaded at once.
Interpolator <: AbstractProvider
+
+Interpolator(f; colormap=:thermal, options=Dict(:minzoom=1, :maxzoom=19))
Provides tiles by interpolating them on the fly.
f
: an Interpolations.jl interpolator or similar.
colormap
: A Symbol
or Vector{RGBA{Float32}}
. Default is :thermal
.
Map(extent, [extent_crs=wgs84]; kw...)
+Map(map::Map; ...) # layering another provider on top of an existing map
Tylers main object, it plots tiles onto a Makie.jl Axis
, downloading and plotting more tiles as you zoom and pan. When layering providers over each other with Map(map::Map; ...)
, you can use toggle_visibility!(map)
to hide/unhide them.
Arguments
-extent
: the initial extent of the map, as a GeometryBasics.Rect
or an Extents.Extent
in the projection of extent_crs
. -extent_crs
: Any GeoFormatTypes
compatible crs, the default is wsg84.
Keywords
-size
: The figure size. -figure
: an existing Makie.Figure
object. -crs
: The providers coordinate reference system. -provider
: a TileProviders.jl Provider
. -max_parallel_downloads
: limits the attempted simultaneous downloads, with a default of 16
. -cache_size_gb
: limits the cache for storing tiles, with a default of 5
. -fetching_scheme=Halo2DTiling()
: The tile fetching scheme. Can be SimpleTiling(), Halo2DTiling(), or Tiling3D(). -scale
: a tile scaling factor. Low number decrease the downloads but reduce the resolution. The default is 0.5
. -plot_config
: A PlotConfig
object to change the way tiles are plotted. -max_zoom
: The maximum zoom level to display, with a default of TileProviders.max_zoom(provider)
. -max_plots=400:
The maximum number of plots to keep displayed at the same time.
Map(m::Map; kw...)
Layering constructor to show another provider on top of an existing map.
Example
lat, lon = (52.395593, 4.884704)
+delta = 0.01
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+m1 = Tyler.Map(ext)
+m2 = Tyler.Map(m1; provider=TileProviders.Esri(:WorldImagery), plot_config=Tyler.PlotConfig(alpha=0.5, postprocess=(p-> translate!(p, 0, 0, 1f0))))
+m1
PlotConfig(; preprocess=identity, postprocess=identity, plot_attributes...)
Creates a PlotConfig
object to influence how tiles are being plotted.
preprocess(tile_data): Function to preprocess the data before plotting. For a tile provider returning image data, preprocess will be called on the image data before plotting.
postprocess(tile_data): Function to mutate the plot object after creation. Can be used like this: (plot)-> translate!(plot, 0, 0, 1)
.
plot_attributes: Additional attributes to pass to the plot
Example
using Tyler, GLMakie
+
+config = PlotConfig(
+ preprocess = (data) -> data .+ 1,
+ postprocess = (plot) -> translate!(plot, 0, 0, 1),
+ color = :red
+)
+lat, lon = (52.395593, 4.884704)
+delta = 0.1
+extent = Extent(; X=(lon - delta / 2, lon + delta / 2), Y=(lat - delta / 2, lat + delta / 2))
+Tyler.Map(extent; provider=Tyler.TileProviders.Esri(:WorldImagery), plot_config=config)
A package for downloading map tiles on demand from different data source providers.
This package is currently in the initial phase of development. It needs support. Sponsorships are welcome!
In the Julia REPL type:
] add Tyler
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
Or, explicitly use Pkg
using Pkg
+Pkg.add(["Tyler.jl"])
using Tyler, GLMakie
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
INFO
A Rect2f
definition takes as input the origin, first two entries, and the width and hight, last two numbers.
We can use a different tile provider as well as any style theme
from Makie as follows:
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenStreetMap(:Mapnik)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ m = Tyler.Map(london; provider)
+ hidedecorations!(m.axis)
+ hidespines!(m.axis)
+ m
+end
More providers are available. See the following list:
providers = TileProviders.list_providers()
Dict{Function, Vector{Symbol}} with 40 entries:
+ GeoportailFrance => [:plan, :parcels, :orthos]
+ Jawg => [:Streets, :Terrain, :Lagoon, :Sunny, :Dark, :Light, :M…
+ OpenStreetMap => [:Mapnik, :DE, :CH, :France, :HOT, :BZH]
+ Thunderforest => [:OpenCycleMap, :Transport, :TransportDark, :SpinalMap,…
+ FreeMapSK => []
+ NASAGIBSTimeseries => [:Agricultural_Lands_Croplands_2000, :Agricultural_Land…
+ HERE => [:normalDay, :normalDayCustom, :normalDayGrey, :normalD…
+ HEREv3 => [:normalDay, :normalDayCustom, :normalDayGrey, :normalD…
+ MtbMap => []
+ BaseMapDE => [:Color, :Grey]
+ WaymarkedTrails => [:hiking, :cycling, :mtb, :slopes, :riding, :skating]
+ TopPlusOpen => [:Color, :Grey]
+ HikeBike => [:HikeBike, :HillShading]
+ OpenSnowMap => [:pistes]
+ OpenRailwayMap => []
+ CartoDB => [:Positron, :PositronNoLabels, :PositronOnlyLabels, :Da…
+ Stadia => [:AlidadeSmooth, :AlidadeSmoothDark, :OSMBright, :Outdo…
+ nlmaps => [:standaard, :pastel, :grijs, :water, :luchtfoto]
+ MapBox => []
+ ⋮ => ⋮
INFO
For some providers additional configuration steps are necessary, look at the TileProviders.jl
documentation for more information.
Although, the figure size can be controlled by passing additional arguments to Map
, it's better to define a Figure first and then continue with a normal Makie's figure creation workflow, namely
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenTopoMap()
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ fig = Figure(; size =(1200,600))
+ ax = Axis(fig[1,1]) # aspect = DataAspect()
+ m = Tyler.Map(london; provider, figure=fig, axis=ax)
+ wait(m)
+ hidedecorations!(ax)
+ hidespines!(ax)
+ fig
+end
Next, we could add any other plot type on top of the ax
axis defined above.
A package for downloading map tiles on demand from different data source providers.
This package is currently in the initial phase of development. It needs support. Sponsorships are welcome!
In the Julia REPL type:
] add Tyler
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
Or, explicitly use Pkg
using Pkg
+Pkg.add(["Tyler.jl"])
using Tyler, GLMakie
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
INFO
A Rect2f
definition takes as input the origin, first two entries, and the width and hight, last two numbers.
We can use a different tile provider as well as any style theme
from Makie as follows:
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenStreetMap(:Mapnik)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ m = Tyler.Map(london; provider)
+ hidedecorations!(m.axis)
+ hidespines!(m.axis)
+ m
+end
More providers are available. See the following list:
providers = TileProviders.list_providers()
Dict{Function, Vector{Symbol}} with 40 entries:
+ GeoportailFrance => [:plan, :parcels, :orthos]
+ Jawg => [:Streets, :Terrain, :Lagoon, :Sunny, :Dark, :Light, :M…
+ OpenStreetMap => [:Mapnik, :DE, :CH, :France, :HOT, :BZH]
+ Thunderforest => [:OpenCycleMap, :Transport, :TransportDark, :SpinalMap,…
+ FreeMapSK => []
+ NASAGIBSTimeseries => [:Agricultural_Lands_Croplands_2000, :Agricultural_Land…
+ HERE => [:normalDay, :normalDayCustom, :normalDayGrey, :normalD…
+ HEREv3 => [:normalDay, :normalDayCustom, :normalDayGrey, :normalD…
+ MtbMap => []
+ BaseMapDE => [:Color, :Grey]
+ WaymarkedTrails => [:hiking, :cycling, :mtb, :slopes, :riding, :skating]
+ TopPlusOpen => [:Color, :Grey]
+ HikeBike => [:HikeBike, :HillShading]
+ OpenSnowMap => [:pistes]
+ OpenRailwayMap => []
+ CartoDB => [:Positron, :PositronNoLabels, :PositronOnlyLabels, :Da…
+ Stadia => [:AlidadeSmooth, :AlidadeSmoothDark, :OSMBright, :Outdo…
+ nlmaps => [:standaard, :pastel, :grijs, :water, :luchtfoto]
+ MapBox => []
+ ⋮ => ⋮
INFO
For some providers additional configuration steps are necessary, look at the TileProviders.jl
documentation for more information.
Although, the figure size can be controlled by passing additional arguments to Map
, it's better to define a Figure first and then continue with a normal Makie's figure creation workflow, namely
using GLMakie, Tyler
+using Tyler.TileProviders
+
+provider = TileProviders.OpenTopoMap()
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+
+with_theme(theme_dark()) do
+ fig = Figure(; size =(1200,600))
+ ax = Axis(fig[1,1]) # aspect = DataAspect()
+ m = Tyler.Map(london; provider, figure=fig, axis=ax)
+ wait(m)
+ hidedecorations!(ax)
+ hidespines!(ax)
+ fig
+end
Next, we could add any other plot type on top of the ax
axis defined above.
using Tyler
+using Tyler.TileProviders
+using Tyler.Extents
+using Dates
+using HTTP
+using Arrow
+using DataFrames
+using GLMakie
+using GLMakie.Colors
+GLMakie.activate!()
INFO
Ice loss from the Greenland Ice Sheet: 1972-2022.
Load ice loss data [courtesy of Chad Greene @ JPL]
url = "https://github.com/JuliaGeo/JuliaGeoData/blob/365a09596bfca59e0977c20c2c2f566c0b29dbaa/assets/data/iceloss_subset.arrow?raw=true";
+resp = HTTP.get(url);
+df = DataFrame(Arrow.Table(resp.body));
+first(df, 5)
select map provider
provider = TileProviders.Esri(:WorldImagery);
Greenland extent
extent = Extent(X = (-54., -48.), Y = (68.8, 72.5));
Extent(X = (-54.0, -48.0), Y = (68.8, 72.5))
extract data
cnt = [length(foo) for foo in df.X];
+X = reduce(vcat,df.X);
+Y = reduce(vcat,df.Y);
+Z = [repeat([i],c) for (i, c) = enumerate(cnt)];
+Z = reduce(vcat,Z);
make a colormap
nc = length(Makie.to_colormap(:thermal));
+n = nrow(df);
+alpha = zeros(nc);
+alpha[1:maximum([1,round(Int64,1*nc/n)])] = alpha[1:maximum([1,round(Int64,1*nc/n)])] .* (1.05^-1.5);
+alpha[maximum([1,round(Int64,1*nc/n)])] = 1;
+cmap = Colors.alphacolor.(Makie.to_colormap(:thermal), alpha);
+cmap = Observable(cmap);
show map
fig = Figure(; size = (1200,600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(extent; provider, figure=fig, axis=ax)
create initial scatter plot
scatter!(ax, X, Y; color = Z, colormap = cmap, colorrange = [0, n], markersize = 10);
+m
add colorbar
a,b = extrema(df.Date);
+a = year(a);
+b = year(b);
+Colorbar(fig[1,2]; colormap = cmap, colorrange = [a,b],
+ height=Relative(0.5), width = 15)
+# hide ticks, grid and lables
+hidedecorations!(ax);
+# hide frames
+hidespines!(ax);
+m
loop to create animation
for k = 1:15
+ # reset apha
+ alpha[:] = zeros(nc);
+ cmap[] = Colors.alphacolor.(cmap[], alpha)
+ for i in 2:1:n
+ # modify alpha
+ alpha[1:maximum([1,round(Int64,i*nc/n)])] = alpha[1:maximum([1,round(Int64,i*nc/n)])] .* (1.05^-1.5);
+ alpha[maximum([1,round(Int64,i*nc/n)])] = 1;
+ cmap[] = Colors.alphacolor.(cmap[], alpha);
+ sleep(0.001);
+ end
+end
using Tyler
+using Tyler.TileProviders
+using Tyler.Extents
+using Dates
+using HTTP
+using Arrow
+using DataFrames
+using GLMakie
+using GLMakie.Colors
+GLMakie.activate!()
INFO
Ice loss from the Greenland Ice Sheet: 1972-2022.
Load ice loss data [courtesy of Chad Greene @ JPL]
url = "https://github.com/JuliaGeo/JuliaGeoData/blob/365a09596bfca59e0977c20c2c2f566c0b29dbaa/assets/data/iceloss_subset.arrow?raw=true";
+resp = HTTP.get(url);
+df = DataFrame(Arrow.Table(resp.body));
+first(df, 5)
select map provider
provider = TileProviders.Esri(:WorldImagery);
Greenland extent
extent = Extent(X = (-54., -48.), Y = (68.8, 72.5));
Extent(X = (-54.0, -48.0), Y = (68.8, 72.5))
extract data
cnt = [length(foo) for foo in df.X];
+X = reduce(vcat,df.X);
+Y = reduce(vcat,df.Y);
+Z = [repeat([i],c) for (i, c) = enumerate(cnt)];
+Z = reduce(vcat,Z);
make a colormap
nc = length(Makie.to_colormap(:thermal));
+n = nrow(df);
+alpha = zeros(nc);
+alpha[1:maximum([1,round(Int64,1*nc/n)])] = alpha[1:maximum([1,round(Int64,1*nc/n)])] .* (1.05^-1.5);
+alpha[maximum([1,round(Int64,1*nc/n)])] = 1;
+cmap = Colors.alphacolor.(Makie.to_colormap(:thermal), alpha);
+cmap = Observable(cmap);
show map
fig = Figure(; size = (1200,600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(extent; provider, figure=fig, axis=ax)
create initial scatter plot
scatter!(ax, X, Y; color = Z, colormap = cmap, colorrange = [0, n], markersize = 10);
+m
add colorbar
a,b = extrema(df.Date);
+a = year(a);
+b = year(b);
+Colorbar(fig[1,2]; colormap = cmap, colorrange = [a,b],
+ height=Relative(0.5), width = 15)
+# hide ticks, grid and lables
+hidedecorations!(ax);
+# hide frames
+hidespines!(ax);
+m
loop to create animation
for k = 1:15
+ # reset apha
+ alpha[:] = zeros(nc);
+ cmap[] = Colors.alphacolor.(cmap[], alpha)
+ for i in 2:1:n
+ # modify alpha
+ alpha[1:maximum([1,round(Int64,i*nc/n)])] = alpha[1:maximum([1,round(Int64,i*nc/n)])] .* (1.05^-1.5);
+ alpha[maximum([1,round(Int64,i*nc/n)])] = 1;
+ cmap[] = Colors.alphacolor.(cmap[], alpha);
+ sleep(0.001);
+ end
+end
INFO
Sine waves
using Tyler, GLMakie
+using Interpolations: interpolate, Gridded, Linear
+
+f(lon,lat)=cosd(16*lon)+sind(16*lat)
+
+f_in_0_1_range(lon,lat)=0.5+0.25*f(lon,lat)
+
+nodes=(-180.0:180.0, -90.0:90.0)
+
+array=[f(lon,lat) for lon in nodes[1], lat in nodes[2]]
+array=(array.-minimum(array))./(maximum(array)-minimum(array))
+
+itp = interpolate(nodes, array, Gridded(Linear()))
+cols=Makie.to_colormap(:viridis)
+
+col(i)=RGBAf(Makie.interpolated_getindex(cols,i))
+fun(x,y) = col(itp(x,y))
+
+options = Dict(:min_zoom => 1,:max_zoom => 19)
+
+p1 = Tyler.Interpolator(f_in_0_1_range; options)
+p2 = Tyler.Interpolator(fun; options)
+
+b = Rect2f(-20.0, -20.0, 40.0, 40.0)
+m = Tyler.Map(b, provider=p1)
TIP
Try b = Rect2f(-180.0, -89.9, 360.0, 179.8)
INFO
interpolated_getindex
requires input i
to be in the 0-1
range.
INFO
Sine waves
using Tyler, GLMakie
+using Interpolations: interpolate, Gridded, Linear
+
+f(lon,lat)=cosd(16*lon)+sind(16*lat)
+
+f_in_0_1_range(lon,lat)=0.5+0.25*f(lon,lat)
+
+nodes=(-180.0:180.0, -90.0:90.0)
+
+array=[f(lon,lat) for lon in nodes[1], lat in nodes[2]]
+array=(array.-minimum(array))./(maximum(array)-minimum(array))
+
+itp = interpolate(nodes, array, Gridded(Linear()))
+cols=Makie.to_colormap(:viridis)
+
+col(i)=RGBAf(Makie.interpolated_getindex(cols,i))
+fun(x,y) = col(itp(x,y))
+
+options = Dict(:min_zoom => 1,:max_zoom => 19)
+
+p1 = Tyler.Interpolator(f_in_0_1_range; options)
+p2 = Tyler.Interpolator(fun; options)
+
+b = Rect2f(-20.0, -20.0, 40.0, 40.0)
+m = Tyler.Map(b, provider=p1)
TIP
Try b = Rect2f(-180.0, -89.9, 360.0, 179.8)
INFO
interpolated_getindex
requires input i
to be in the 0-1
range.
Tyler also offers to view tiles in 3D, and offers a simple Elevation and PointCloud provider.
using Tyler, GLMakie
+using Tyler: ElevationProvider
+
+lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon-delta/2, lat-delta/2, delta, delta)
+m = Tyler.Map3D(ext; provider=ElevationProvider())
With PlotConfig one can change the way tiles are plotted. The it has a preprocess + postprocess function and allows to pass any plot attribute to the tile. These attributes are global and will be passed to every tile plot.
lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading, colorrange=(2000, 5000),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext; provider=ElevationProvider(nothing), plot_config=cfg)
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.03
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+m = Tyler.Map3D(ext; provider=provider)
There is also a MeshScatter plot config, which can be used to switch the point cloud plotting from scatter to meshscatter. This looks better, at a significant slow down.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.008
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+image = ElevationProvider(nothing)
+cfg = Tyler.MeshScatterPlotconfig()
+m1 = Tyler.Map3D(ext; provider=provider, plot_config=cfg)
+cfg = Tyler.PlotConfig(preprocess=pc -> map(p -> p .* 2, pc), shading=FastShading, colormap=:alpine)
+m2 = Tyler.Map3D(m1; provider=image, plot_config=cfg)
+m1
using RPRMakie, FileIO
+function render_rpr(m, name, radiance=1000000)
+ wait(m)
+ ax = m.axis
+ cam = ax.scene.camera_controls
+ lightpos = Vec3f(cam.lookat[][1], cam.lookat[][2], cam.eyeposition[][3])
+ lights = [
+ EnvironmentLight(1.5, load(RPR.assetpath("studio026.exr"))),
+ PointLight(lightpos, RGBf(radiance, radiance * 0.9, radiance * 0.9))
+ ]
+ empty!(ax.scene.lights)
+ append!(ax.scene.lights, lights)
+ save("$(name).png", ax.scene; plugin=RPR.Northstar, backend=RPRMakie, iterations=2000)
+end
+function plastic_material()
+ return (type=:Uber, reflection_color=Vec4f(1),
+ reflection_weight=Vec4f(1), reflection_roughness=Vec4f(0.1),
+ reflection_anisotropy=Vec4f(0), reflection_anisotropy_rotation=Vec4f(0),
+ reflection_metalness=Vec4f(0), reflection_ior=Vec4f(1.4), refraction_weight=Vec4f(0),
+ coating_weight=Vec4f(0), sheen_weight=Vec4f(0), emission_weight=Vec3f(0),
+ transparency=Vec4f(0), reflection_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR),
+ emission_mode=UInt(RPR.RPR_UBER_MATERIAL_EMISSION_MODE_SINGLESIDED),
+ coating_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR), sss_multiscatter=true,
+ refraction_thin_surface=true)
+end
lat, lon = (47.087441, 13.377214)
+delta = 0.5
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading,
+ material=plastic_material(),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext;
+ provider=ElevationProvider(nothing),
+ plot_config=cfg,
+ max_plots=5
+)
+render_rpr(m, "alpine", 10000000)
lat, lon = (52.40459835229174, 4.84763329882317)
+delta = 0.005
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+mat = (type=:Microfacet, roughness=0.2, ior=1.390)
+cfg = Tyler.MeshScatterPlotconfig(material=mat, markersize=4)
+m = Tyler.Map3D(ext; provider=provider, plot_config=cfg, max_plots=3, size=(2000, 2000))
+cfg = Tyler.PlotConfig(material=mat, colormap=:Blues)
+m2 = Tyler.Map3D(m; provider=ElevationProvider(nothing), plot_config=cfg, max_plots=5)
+render_rpr(m, "pointclouds")
+cp(Tyler)
Tyler also offers to view tiles in 3D, and offers a simple Elevation and PointCloud provider.
using Tyler, GLMakie
+using Tyler: ElevationProvider
+
+lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon-delta/2, lat-delta/2, delta, delta)
+m = Tyler.Map3D(ext; provider=ElevationProvider())
With PlotConfig one can change the way tiles are plotted. The it has a preprocess + postprocess function and allows to pass any plot attribute to the tile. These attributes are global and will be passed to every tile plot.
lat, lon = (47.087441, 13.377214)
+delta = 0.3
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading, colorrange=(2000, 5000),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext; provider=ElevationProvider(nothing), plot_config=cfg)
The PointCloud provider downloads from geotiles.citg.tudelft, which spans most of the netherlands.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.03
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+m = Tyler.Map3D(ext; provider=provider)
There is also a MeshScatter plot config, which can be used to switch the point cloud plotting from scatter to meshscatter. This looks better, at a significant slow down.
lat, lon = (52.40459835, 4.84763329)
+delta = 0.008
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+image = ElevationProvider(nothing)
+cfg = Tyler.MeshScatterPlotconfig()
+m1 = Tyler.Map3D(ext; provider=provider, plot_config=cfg)
+cfg = Tyler.PlotConfig(preprocess=pc -> map(p -> p .* 2, pc), shading=FastShading, colormap=:alpine)
+m2 = Tyler.Map3D(m1; provider=image, plot_config=cfg)
+m1
using RPRMakie, FileIO
+function render_rpr(m, name, radiance=1000000)
+ wait(m)
+ ax = m.axis
+ cam = ax.scene.camera_controls
+ lightpos = Vec3f(cam.lookat[][1], cam.lookat[][2], cam.eyeposition[][3])
+ lights = [
+ EnvironmentLight(1.5, load(RPR.assetpath("studio026.exr"))),
+ PointLight(lightpos, RGBf(radiance, radiance * 0.9, radiance * 0.9))
+ ]
+ empty!(ax.scene.lights)
+ append!(ax.scene.lights, lights)
+ save("$(name).png", ax.scene; plugin=RPR.Northstar, backend=RPRMakie, iterations=2000)
+end
+function plastic_material()
+ return (type=:Uber, reflection_color=Vec4f(1),
+ reflection_weight=Vec4f(1), reflection_roughness=Vec4f(0.1),
+ reflection_anisotropy=Vec4f(0), reflection_anisotropy_rotation=Vec4f(0),
+ reflection_metalness=Vec4f(0), reflection_ior=Vec4f(1.4), refraction_weight=Vec4f(0),
+ coating_weight=Vec4f(0), sheen_weight=Vec4f(0), emission_weight=Vec3f(0),
+ transparency=Vec4f(0), reflection_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR),
+ emission_mode=UInt(RPR.RPR_UBER_MATERIAL_EMISSION_MODE_SINGLESIDED),
+ coating_mode=UInt(RPR.RPR_UBER_MATERIAL_IOR_MODE_PBR), sss_multiscatter=true,
+ refraction_thin_surface=true)
+end
lat, lon = (47.087441, 13.377214)
+delta = 0.5
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+cfg = Tyler.PlotConfig(
+ preprocess=pc -> map(p -> p .* 2, pc),
+ shading=FastShading,
+ material=plastic_material(),
+ colormap=:alpine
+)
+m = Tyler.Map3D(ext;
+ provider=ElevationProvider(nothing),
+ plot_config=cfg,
+ max_plots=5
+)
+render_rpr(m, "alpine", 10000000)
lat, lon = (52.40459835229174, 4.84763329882317)
+delta = 0.005
+ext = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta)
+provider = Tyler.GeoTilePointCloudProvider()
+mat = (type=:Microfacet, roughness=0.2, ior=1.390)
+cfg = Tyler.MeshScatterPlotconfig(material=mat, markersize=4)
+m = Tyler.Map3D(ext; provider=provider, plot_config=cfg, max_plots=3, size=(2000, 2000))
+cfg = Tyler.PlotConfig(material=mat, colormap=:Blues)
+m2 = Tyler.Map3D(m; provider=ElevationProvider(nothing), plot_config=cfg, max_plots=5)
+render_rpr(m, "pointclouds")
+cp(Tyler)
In this example, we combine OpenStreetMap data, loading some roads and buildings and plotting them on top of a Tyler map.
using Tyler, Tyler.TileProviders
+using GLMakie, OSMMakie, LightOSM
+
+area = (
+ minlat = 51.50, minlon = -0.0921, # bottom left corner
+ maxlat = 51.52, maxlon = -0.0662 # top right corner
+)
+
+download_osm_network(:bbox; # rectangular area
+ area..., # splat previously defined area boundaries
+ network_type=:drive, # download motorways
+ save_to_file_location="london_drive.json"
+);
+
+osm = graph_from_file("london_drive.json";
+ graph_type=:light, # SimpleDiGraph
+ weight_type=:distance
+)
+
+download_osm_buildings(:bbox;
+ area...,
+ metadata=true,
+ download_format=:osm,
+ save_to_file_location="london_buildings.osm"
+);
+
+# load as Buildings Dict
+buildings = buildings_from_file("london_buildings.osm");
+# Google + OSM
+provider = TileProviders.Google(:satelite)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+m = Tyler.Map(london; provider=provider, crs=Tyler.wgs84)
+m.axis.aspect = map_aspect(area.minlat, area.maxlat)
+p = osmplot!(m.axis, osm; buildings)
+# DataInspector(m.axis) # this is broken/slow
+m
In this example, we combine OpenStreetMap data, loading some roads and buildings and plotting them on top of a Tyler map.
using Tyler, Tyler.TileProviders
+using GLMakie, OSMMakie, LightOSM
+
+area = (
+ minlat = 51.50, minlon = -0.0921, # bottom left corner
+ maxlat = 51.52, maxlon = -0.0662 # top right corner
+)
+
+download_osm_network(:bbox; # rectangular area
+ area..., # splat previously defined area boundaries
+ network_type=:drive, # download motorways
+ save_to_file_location="london_drive.json"
+);
+
+osm = graph_from_file("london_drive.json";
+ graph_type=:light, # SimpleDiGraph
+ weight_type=:distance
+)
+
+download_osm_buildings(:bbox;
+ area...,
+ metadata=true,
+ download_format=:osm,
+ save_to_file_location="london_buildings.osm"
+);
+
+# load as Buildings Dict
+buildings = buildings_from_file("london_buildings.osm");
+# Google + OSM
+provider = TileProviders.Google(:satelite)
+london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+m = Tyler.Map(london; provider=provider, crs=Tyler.wgs84)
+m.axis.aspect = map_aspect(area.minlat, area.maxlat)
+p = osmplot!(m.axis, osm; buildings)
+# DataInspector(m.axis) # this is broken/slow
+m
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using Tyler.Extents
select a map provider
provider = TileProviders.Esri(:WorldImagery)
TileProviders.Provider("https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", Dict{Symbol, Any}(:url => "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", :attribution => "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", :variant => "World_Imagery", :name => "Esri.WorldImagery", :html_attribution => "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"))
define a point to plot on the map
# point location to add to map
+lat = 34.2013;
+lon = -118.1714;
-118.1714
convert to point in web_mercator
pts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))
2-element GeometryBasics.Point{2, Float32} with indices SOneTo(2):
+ -1.315478f7
+ 4.0558638f6
set how much area to map in degrees and define an Extent
for display in web_mercator
delta = 1
+extent = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta);
GeometryBasics.HyperRectangle{2, Float32}(Float32[-118.6714, 33.7013], Float32[1.0, 1.0])
show map
m = Tyler.Map(extent; provider, size=(1000, 600))
now plot a point, polygon and text on the map
objscatter = scatter!(m.axis, pts; color = :red,
+ marker = '⭐', markersize = 50)
+# hide ticks, grid and lables
+hidedecorations!(m.axis)
+# hide frames
+hidespines!(m.axis)
+# Plot a plygon on the map
+p1 = (lon-delta/8, lat-delta/8)
+p2 = (lon-delta/8, lat+delta/8)
+p3 = (lon+delta/8, lat+delta/8)
+p4 = (lon+delta/8, lat-delta/8)
+
+polyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))
+polyg = Point2f.(polyg)
+poly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)
+
+# Add text
+pts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))
+text!(pts2, text = "Basic Example"; fontsize = 30,
+ color = :darkblue, align = (:center, :center)
+ )
+m
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using Tyler.Extents
select a map provider
provider = TileProviders.Esri(:WorldImagery)
TileProviders.Provider("https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", Dict{Symbol, Any}(:url => "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}", :attribution => "Tiles (C) Esri -- Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community", :variant => "World_Imagery", :name => "Esri.WorldImagery", :html_attribution => "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"))
define a point to plot on the map
# point location to add to map
+lat = 34.2013;
+lon = -118.1714;
-118.1714
convert to point in web_mercator
pts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))
2-element GeometryBasics.Point{2, Float32} with indices SOneTo(2):
+ -1.315478f7
+ 4.0558638f6
set how much area to map in degrees and define an Extent
for display in web_mercator
delta = 1
+extent = Rect2f(lon - delta / 2, lat - delta / 2, delta, delta);
GeometryBasics.HyperRectangle{2, Float32}(Float32[-118.6714, 33.7013], Float32[1.0, 1.0])
show map
m = Tyler.Map(extent; provider, size=(1000, 600))
now plot a point, polygon and text on the map
objscatter = scatter!(m.axis, pts; color = :red,
+ marker = '⭐', markersize = 50)
+# hide ticks, grid and lables
+hidedecorations!(m.axis)
+# hide frames
+hidespines!(m.axis)
+# Plot a plygon on the map
+p1 = (lon-delta/8, lat-delta/8)
+p2 = (lon-delta/8, lat+delta/8)
+p3 = (lon+delta/8, lat+delta/8)
+p4 = (lon+delta/8, lat-delta/8)
+
+polyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))
+polyg = Point2f.(polyg)
+poly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)
+
+# Add text
+pts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))
+text!(pts2, text = "Basic Example"; fontsize = 30,
+ color = :darkblue, align = (:center, :center)
+ )
+m
The full stack of Makie's ecosystem works.
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using Downloads: download
Here, we will be using points that originally are in longitude and latitute, hence a function to transform those into the web_mercator projection is defined,
function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
and downloading and preparing the data is done next
url = "https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv"
+d = download(url)
+whale = CSV.read(d, DataFrame)
+lon = whale[!, :lon]
+lat = whale[!, :lat]
+steps = size(lon,1)
+points = to_web_mercator.(lon,lat)
+
+lomn, lomx = extrema(lon)
+lamn, lamx = extrema(lat)
+δlon = abs(lomn - lomx)
+δlat = abs(lamn - lamx)
INFO
Whale shark movements in Gulf of Mexico.
Then a provider and the initial map are set
provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+
+set_theme!(theme_dark())
+fig = Figure(; size = (1200, 600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(Rect2f(Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat));
+ provider, figure=fig, axis=ax)
nt = 30
+trail = CircularBuffer{Point2f}(nt)
+fill!(trail, points[1]) # add correct values to the circular buffer
+trail = Observable(trail) # make it an observable
+whale = Observable(points[1])
+
+c = to_color(:orangered)
+trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail
+
+objline = lines!(ax, trail; color = trailcolor, linewidth=3)
+objscatter = scatter!(ax, whale; markersize = 15, color = :orangered,
+ strokecolor=:white, strokewidth=1.5)
+hidedecorations!(ax)
+hidespines!(ax)
+m
The animation is done by updating the Observable values
record(fig, "whale_shark_128786.mp4") do io
+ for i in 2:steps
+ push!(trail[], points[i])
+ whale[] = points[i]
+ trail[] = trail[]
+ recordframe!(io) # record a new frame
+ end
+end
+set_theme!() # reset theme (default)
The full stack of Makie's ecosystem works.
Load packages
using Tyler, GLMakie
+using Tyler.TileProviders
+using Tyler.MapTiles
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using Downloads: download
Here, we will be using points that originally are in longitude and latitute, hence a function to transform those into the web_mercator projection is defined,
function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
and downloading and preparing the data is done next
url = "https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv"
+d = download(url)
+whale = CSV.read(d, DataFrame)
+lon = whale[!, :lon]
+lat = whale[!, :lat]
+steps = size(lon,1)
+points = to_web_mercator.(lon,lat)
+
+lomn, lomx = extrema(lon)
+lamn, lamx = extrema(lat)
+δlon = abs(lomn - lomx)
+δlat = abs(lamn - lamx)
INFO
Whale shark movements in Gulf of Mexico.
Then a provider and the initial map are set
provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+
+set_theme!(theme_dark())
+fig = Figure(; size = (1200, 600))
+ax = Axis(fig[1,1])
+m = Tyler.Map(Rect2f(Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat));
+ provider, figure=fig, axis=ax)
nt = 30
+trail = CircularBuffer{Point2f}(nt)
+fill!(trail, points[1]) # add correct values to the circular buffer
+trail = Observable(trail) # make it an observable
+whale = Observable(points[1])
+
+c = to_color(:orangered)
+trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail
+
+objline = lines!(ax, trail; color = trailcolor, linewidth=3)
+objscatter = scatter!(ax, whale; markersize = 15, color = :orangered,
+ strokecolor=:white, strokewidth=1.5)
+hidedecorations!(ax)
+hidespines!(ax)
+m
The animation is done by updating the Observable values
record(fig, "whale_shark_128786.mp4") do io
+ for i in 2:steps
+ push!(trail[], points[i])
+ whale[] = points[i]
+ trail[] = trail[]
+ recordframe!(io) # record a new frame
+ end
+end
+set_theme!() # reset theme (default)
using Tyler, GLMakie
+using TileProviders
+using MapTiles
+
This page was generated using Literate.jl.
+ + + + + + +using Tyler, GLMakie
+
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
+
Info
+London
+This page was generated using Literate.jl.
+ + + + + + +using Tyler, GLMakie
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using TileProviders
+using MapTiles
+using Downloads: download
+
+function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
+
+url = "https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv"
+d = download(url)
+whale = CSV.read(d, DataFrame)
+lon = whale[!, :lon]
+lat = whale[!, :lat]
+steps = size(lon,1)
+points = to_web_mercator.(lon,lat)
+
+lomn, lomx = extrema(lon)
+lamn, lamx = extrema(lat)
+δlon = abs(lomn - lomx)
+δlat = abs(lamn - lamx)
+
+provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+
+set_theme!(theme_black())
+m = Tyler.Map(Rect2f(Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat)), 5;
+ provider, min_tiles=8, max_tiles=16)
+wait(m)
+
+nt = 30
+trail = CircularBuffer{Point2f}(nt)
+fill!(trail, points[1]) # add correct values to the circular buffer
+trail = Observable(trail) # make it an observable
+whale = Observable(points[1])
+
+c = to_color(:dodgerblue)
+trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail
+
+objline = lines!(m.axis, trail; color = trailcolor, linewidth=3)
+objscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered,
+ strokecolor=:grey90, strokewidth=1)
+hidedecorations!(m.axis)
+translate!(objline, 0, 0, 2)
+translate!(objscatter, 0, 0, 2)
+#limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))
+# the animation is done by updating the Observable values
+# change assets->(your folder) to make it work in your local env
+record(m.figure, joinpath("assets", "whale_shark_128786.mp4")) do io
+ for i in 2:steps
+ push!(trail[], points[i])
+ whale[] = points[i]
+ trail[] = trail[]
+ recordframe!(io) # record a new frame
+ end
+end
+set_theme!()
+
Info
+Whale shark movements in Gulf of Mexico. Contact person: Eric Hoffmayer
+This page was generated using Literate.jl.
+ + + + + + +A package for downloading map tiles on demand from different data source providers.
+Info
+In the Julia REPL type:
+using Pkg
+Pkg.add(["https://github.com/JuliaGeo/TileProviders.jl", "https://github.com/SimonDanisch/MapTiles.jl.git", "https://github.com/MakieOrg/Tyler.jl.git"])
+
or
+] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git
+
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
A package for downloading map tiles on demand from different data source providers.
Info
In the Julia REPL type:
using Pkg\nPkg.add([\"https://github.com/JuliaGeo/TileProviders.jl\", \"https://github.com/SimonDanisch/MapTiles.jl.git\", \"https://github.com/MakieOrg/Tyler.jl.git\"])\n
or
] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git\n
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
using Tyler, GLMakie\nusing TileProviders\nusing MapTiles\n
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/start/","title":"Basic demo","text":""},{"location":"examples/generated/UserGuide/start/#quick-start-into-tyler","title":"Quick start into Tyler","text":""},{"location":"examples/generated/UserGuide/start/#a-basic-request","title":"A basic request","text":"using Tyler, GLMakie\n\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))\n
Info
London
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/whale_ex/","title":"Whale shark trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#whale-shark-exampe-trajectory","title":"Whale shark exampe trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#using-the-full-stack-of-makie-should-just-work","title":"Using the full stack of Makie should just work.","text":"using Tyler, GLMakie\nusing CSV, DataFrames\nusing DataStructures: CircularBuffer\nusing TileProviders\nusing MapTiles\nusing Downloads: download\n\nfunction to_web_mercator(lo,lat)\nreturn Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))\nend\n\nurl = \"https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv\"\nd = download(url)\nwhale = CSV.read(d, DataFrame)\nlon = whale[!, :lon]\nlat = whale[!, :lat]\nsteps = size(lon,1)\npoints = to_web_mercator.(lon,lat)\n\nlomn, lomx = extrema(lon)\nlamn, lamx = extrema(lat)\n\u03b4lon = abs(lomn - lomx)\n\u03b4lat = abs(lamn - lamx)\n\nprovider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)\n\nset_theme!(theme_black())\nm = Tyler.Map(Rect2f(Rect2f(lomn - \u03b4lon/2, lamn-\u03b4lat/2, 2\u03b4lon, 2\u03b4lat)), 5;\nprovider, min_tiles=8, max_tiles=16)\nwait(m)\n\nnt = 30\ntrail = CircularBuffer{Point2f}(nt)\nfill!(trail, points[1]) # add correct values to the circular buffer\ntrail = Observable(trail) # make it an observable\nwhale = Observable(points[1])\n\nc = to_color(:dodgerblue)\ntrailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail\n\nobjline = lines!(m.axis, trail; color = trailcolor, linewidth=3)\nobjscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered,\nstrokecolor=:grey90, strokewidth=1)\nhidedecorations!(m.axis)\ntranslate!(objline, 0, 0, 2)\ntranslate!(objscatter, 0, 0, 2)\n#limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))\n# the animation is done by updating the Observable values\n# change assets->(your folder) to make it work in your local env\nrecord(m.figure, joinpath(\"assets\", \"whale_shark_128786.mp4\")) do io\nfor i in 2:steps\npush!(trail[], points[i])\nwhale[] = points[i]\ntrail[] = trail[]\nrecordframe!(io) # record a new frame\nend\nend\nset_theme!()\n
Info
Whale shark movements in Gulf of Mexico. Contact person: Eric Hoffmayer
This page was generated using Literate.jl.
"}]} \ No newline at end of file diff --git a/previews/PR12/siteinfo.js b/previews/PR12/siteinfo.js new file mode 100644 index 00000000..d0a1e48e --- /dev/null +++ b/previews/PR12/siteinfo.js @@ -0,0 +1 @@ +var DOCUMENTER_CURRENT_VERSION = "previews/PR12"; diff --git a/previews/PR12/sitemap.xml b/previews/PR12/sitemap.xml new file mode 100644 index 00000000..7f4d15ae --- /dev/null +++ b/previews/PR12/sitemap.xml @@ -0,0 +1,23 @@ + +using Tyler, GLMakie
+
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
+
Info
+This is just a test ok?
+This page was generated using Literate.jl.
+ + + + + + +Tiles yler
+A package for downloading tiles on demand from different providers.
+Info
+In the Julia REPL type:
+using Pkg
+Pkg.add(["https://github.com/JuliaGeo/TileProviders.jl", "https://github.com/SimonDanisch/MapTiles.jl.git", "https://github.com/MakieOrg/Tyler.jl.git"])
+
or
+] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git
+
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
Tiles yler
A package for downloading tiles on demand from different providers.
Info
In the Julia REPL type:
using Pkg\nPkg.add([\"https://github.com/JuliaGeo/TileProviders.jl\", \"https://github.com/SimonDanisch/MapTiles.jl.git\", \"https://github.com/MakieOrg/Tyler.jl.git\"])\n
or
] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git\n
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
using Tyler, GLMakie\n\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))\n
Info
This is just a test ok?
This page was generated using Literate.jl.
"}]} \ No newline at end of file diff --git a/previews/PR2/siteinfo.js b/previews/PR2/siteinfo.js new file mode 100644 index 00000000..926f6872 --- /dev/null +++ b/previews/PR2/siteinfo.js @@ -0,0 +1 @@ +var DOCUMENTER_CURRENT_VERSION = "previews/PR2"; diff --git a/previews/PR2/sitemap.xml b/previews/PR2/sitemap.xml new file mode 100644 index 00000000..5d483b20 --- /dev/null +++ b/previews/PR2/sitemap.xml @@ -0,0 +1,13 @@ + +using Tyler, GLMakie
+
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
+
Info
+London
+This page was generated using Literate.jl.
+ + + + + + +using Tyler, GLMakie
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using TileProviders
+using MapTiles
+
+function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
+
+provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025), 5;
+ provider, min_tiles=8, max_tiles=16)
+
Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat)
+whale = CSV.read("./examples/data/whaleshark128786.csv", DataFrame) lon = whale[!, :lon] lat = whale[!, :lat] steps = size(lon,1)
+points = towebmercator.(lon,lat)
+lomn, lomx = extrema(lon) lamn, lamx = extrema(lat) δlon = abs(lomn - lomx) δlat = abs(lamn - lamx)
+nt = 30 trail = CircularBuffer{Point2f}(nt) fill!(trail, points[1]) # add correct values to the circular buffer trail = Observable(trail) # make it an observable whale = Observable(points[1])
+c = to_color(:dodgerblue) trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail wait(m)
+objline = lines!(m.axis, trail; color = trailcolor, linewidth=3) objscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered, strokecolor=:grey90, strokewidth=1) hidedecorations!(m.axis) translate!(objline, 0, 0, 2) translate!(objscatter, 0, 0, 2) #limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))
+ + +record(m.figure, joinpath("assets", "whaleshark128786.mp4")) do io for i in 2:steps push!(trail[], points[i]) whale[] = points[i] trail[] = trail[] recordframe!(io) # record a new frame end end
+Info
+Whale shark movements in Gulf of Mexico. Contact person: Eric Hoffmayer
+# ![type:video](./assets/whale_shark_128786.mp4)
+
This page was generated using Literate.jl.
+ + + + + + +A package for downloading map tiles on demand from different data source providers.
+Info
+In the Julia REPL type:
+using Pkg
+Pkg.add(["https://github.com/JuliaGeo/TileProviders.jl", "https://github.com/SimonDanisch/MapTiles.jl.git", "https://github.com/MakieOrg/Tyler.jl.git"])
+
or
+] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git
+
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
A package for downloading map tiles on demand from different data source providers.
Info
In the Julia REPL type:
using Pkg\nPkg.add([\"https://github.com/JuliaGeo/TileProviders.jl\", \"https://github.com/SimonDanisch/MapTiles.jl.git\", \"https://github.com/MakieOrg/Tyler.jl.git\"])\n
or
] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git\n
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
using Tyler, GLMakie\n\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))\n
Info
London
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/whale_ex/","title":"Whale shark trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#whale-shark-exampe-trajectory","title":"Whale shark exampe trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#using-the-full-stack-of-makie-should-just-work","title":"Using the full stack of Makie should just work.","text":"using Tyler, GLMakie\nusing CSV, DataFrames\nusing DataStructures: CircularBuffer\nusing TileProviders\nusing MapTiles\n\nfunction to_web_mercator(lo,lat)\nreturn Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))\nend\n\nprovider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025), 5;\nprovider, min_tiles=8, max_tiles=16)\n
Rect2f(lomn - \u03b4lon/2, lamn-\u03b4lat/2, 2\u03b4lon, 2\u03b4lat)
whale = CSV.read(\"./examples/data/whaleshark128786.csv\", DataFrame) lon = whale[!, :lon] lat = whale[!, :lat] steps = size(lon,1)
points = towebmercator.(lon,lat)
lomn, lomx = extrema(lon) lamn, lamx = extrema(lat) \u03b4lon = abs(lomn - lomx) \u03b4lat = abs(lamn - lamx)
nt = 30 trail = CircularBuffer{Point2f}(nt) fill!(trail, points[1]) # add correct values to the circular buffer trail = Observable(trail) # make it an observable whale = Observable(points[1])
c = to_color(:dodgerblue) trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail wait(m)
objline = lines!(m.axis, trail; color = trailcolor, linewidth=3) objscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered, strokecolor=:grey90, strokewidth=1) hidedecorations!(m.axis) translate!(objline, 0, 0, 2) translate!(objscatter, 0, 0, 2) #limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))
"},{"location":"examples/generated/UserGuide/whale_ex/#the-animation-is-done-by-updating-the-observable-values","title":"the animation is done by updating the Observable values","text":""},{"location":"examples/generated/UserGuide/whale_ex/#change-assets-your-folder-to-make-it-work-in-your-local-env","title":"change assets->(your folder) to make it work in your local env","text":"record(m.figure, joinpath(\"assets\", \"whaleshark128786.mp4\")) do io for i in 2:steps push!(trail[], points[i]) whale[] = points[i] trail[] = trail[] recordframe!(io) # record a new frame end end
Info
Whale shark movements in Gulf of Mexico. Contact person: Eric Hoffmayer
# ![type:video](./assets/whale_shark_128786.mp4)\n
This page was generated using Literate.jl.
"}]} \ No newline at end of file diff --git a/previews/PR4/siteinfo.js b/previews/PR4/siteinfo.js new file mode 100644 index 00000000..7310be9e --- /dev/null +++ b/previews/PR4/siteinfo.js @@ -0,0 +1 @@ +var DOCUMENTER_CURRENT_VERSION = "previews/PR4"; diff --git a/previews/PR4/sitemap.xml b/previews/PR4/sitemap.xml new file mode 100644 index 00000000..362c0af2 --- /dev/null +++ b/previews/PR4/sitemap.xml @@ -0,0 +1,18 @@ + +Contributing with examples can be done by first creating a new file example here
+Info
+your_new_file.jl
at docs/examples/UserGuide/
Once this is done you need to add a new entry here at the bottom and the appropiate level.
+Info
+Your new entry should look like:
+"Your title example" : "examples/generated/UserGuide/your_new_file.md"
This page was generated using Literate.jl.
load packages
+using Tyler, GLMakie
+using TileProviders
+using MapTiles
+using Extents
+
+# select a map provider
+provider = TileProviders.Esri(:WorldImagery)
+# Plot a point on the map
+# point location to add to map
+lat = 34.2013;
+lon = -118.1714;
+# convert to point in web_mercator
+pts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))
+# set how much area to map in degrees
+delta = 1;
+# define Extent for display in web_mercator
+extent = Extent(X = (lon - delta/2, lon + delta/2), Y = (lat-delta/2, lat+delta/2));
+
+# show map
+m = Tyler.Map(extent; provider, figure=Figure(resolution=(1000, 600)))
+# wait for tiles to fully load
+wait(m)
+
Plot point on map
+objscatter = scatter!(m.axis, pts; color = :red,
+ marker = '⭐', markersize = 50)
+# hide ticks, grid and lables
+hidedecorations!(m.axis)
+# hide frames
+hidespines!(m.axis)
+# Plot a plygon on the map
+p1 = (lon-delta/8, lat-delta/8)
+p2 = (lon-delta/8, lat+delta/8)
+p3 = (lon+delta/8, lat+delta/8)
+p4 = (lon+delta/8, lat-delta/8)
+
+polyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))
+polyg = Point2f.(polyg)
+poly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)
+
+# Add text
+pts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))
+text!(pts2, text = "Basic Example"; fontsize = 30,
+ color = :darkblue, align = (:center, :center)
+ )
+# show figure
+m
+
This page was generated using Literate.jl.
using Tyler
+using GLMakie
+using Arrow
+using DataFrames
+using TileProviders
+using Extents
+using Colors
+using Dates
+using HTTP
+
+url = "https://github.com/JuliaGeo/JuliaGeoData/blob/365a09596bfca59e0977c20c2c2f566c0b29dbaa/assets/data/iceloss_subset.arrow?raw=true";
+
+# parameter for scaling figure size
+scale = 1;
+
+# load ice loss data [courtesy of Chad Greene @ JPL]
+resp = HTTP.get(url);
+df = DataFrame(Arrow.Table(resp.body));
+
+# select map provider
+provider = TileProviders.Esri(:WorldImagery);
+
+# Greenland extent
+extent = Extent(X = (-54., -48.), Y = (68.8, 72.5));
+
+# extract data
+cnt = [length(foo) for foo in df.X];
+X = reduce(vcat,df.X);
+Y = reduce(vcat,df.Y);
+Z = [repeat([i],c) for (i, c) = enumerate(cnt)];
+Z = reduce(vcat,Z);
+
+# make color map
+nc = length(Makie.to_colormap(:thermal));
+n = nrow(df);
+alpha = zeros(nc);
+alpha[1:maximum([1,round(Int64,1*nc/n)])] = alpha[1:maximum([1,round(Int64,1*nc/n)])] .* (1.05^-1.5);
+alpha[maximum([1,round(Int64,1*nc/n)])] = 1;
+cmap = Colors.alphacolor.(Makie.to_colormap(:thermal), alpha);
+cmap = Observable(cmap);
+
+# show map
+m = Tyler.Map(extent; provider, figure=Figure(resolution=(1912 * scale, 2284 * scale)));
+
+# create initial scatter plot
+scatter!(m.axis, X, Y; color = Z, colormap = cmap, colorrange = [0, n], markersize = 10);
+
+# add color bar
+a,b = extrema(df.Date);
+a = year(a);
+b = year(b);
+Colorbar(m.figure[1,2]; colormap = cmap, colorrange = [a,b], ticklabelsize = 50 * scale, width = 100 * scale);
+
+# hide ticks, grid and lables
+hidedecorations!(m.axis);
+
+# hide frames
+hidespines!(m.axis);
+
+# wait for tiles to fully load
+wait(m)
+
# ------ uncomment to create interactive-animated figure -----
+# The Documenter does not allow creations of interactive plots
+
+# loop to create animation
+
if interactive for k = 1:15 # reset apha alpha[:] = zeros(nc); cmap[] = Colors.alphacolor.(cmap[], alpha)
+ for i in 2:1:n
+ # modify alpha
+ alpha[1:maximum([1,round(Int64,i*nc/n)])] = alpha[1:maximum([1,round(Int64,i*nc/n)])] .* (1.05^-1.5);
+ alpha[maximum([1,round(Int64,i*nc/n)])] = 1;
+ cmap[] = Colors.alphacolor.(cmap[], alpha);
+ sleep(0.001);
+ end
+end
+
end
+# -----------------------------------------------------------
+
Info
+Ice loss from the Greenland Ice Sheet: 1972-2022.
+Contact person: Alex Gardner & Chad Greene
+This page was generated using Literate.jl.
using Tyler, GLMakie
+using Interpolations: interpolate, Gridded, Linear
+
+f(lon,lat)=cosd(16*lon)+sind(16*lat)
+
+f_in_0_1_range(lon,lat)=0.5+0.25*f(lon,lat)
+
+nodes=(-180.0:180.0, -90.0:90.0)
+array=[f(lon,lat) for lon in nodes[1], lat in nodes[2]]
+array=(array.-minimum(array))./(maximum(array)-minimum(array))
+itp = interpolate(nodes, array, Gridded(Linear()))
+cols=Makie.to_colormap(:viridis)
+col(i)=RGBAf(Makie.interpolated_getindex(cols,i))
+fun(x,y) = col(itp(x,y))
+
+options = Dict(:min_zoom => 1,:max_zoom => 19)
+p1 = Tyler.Interpolator(f_in_0_1_range; options)
+p2 = Tyler.Interpolator(fun; options)
+
+b = Rect2f(-20.0, -20.0, 40.0, 40.0)
+m = Tyler.Map(b, provider=p1)
+
Info
+Sine Waves
+Tip
+Try b = Rect2f(-180.0, -89.9, 360.0, 179.8)
Tip
+interpolated_getindex
requires input i
to be in the 0-1 range
This page was generated using Literate.jl.
using Tyler, GLMakie
+using TileProviders
+using MapTiles
+
Several providers are available (unfortunally is hard to find the ones that work properly). See the following list:
+providers = TileProviders.list_providers()
+
Dict{Function, Vector{Symbol}} with 39 entries:
+ SwissFederalGeoportal => [:NationalMapColor, :NationalMapGrey, :SWISSIMAGE]
+ GeoportailFrance => [:plan, :parcels, :orthos]
+ OpenSnowMap => [:pistes]
+ Google => [:satelite, :roadmap, :terrain, :hybrid]
+ OpenRailwayMap => []
+ WaymarkedTrails => [:hiking, :cycling, :mtb, :slopes, :riding, :skating]
+ NLS => []
+ MapTilesAPI => [:OSMEnglish, :OSMFrancais, :OSMEspagnol]
+ Stamen => [:Toner, :TonerBackground, :TonerHybrid, :TonerLines…
+ TomTom => [:Basic, :Hybrid, :Labels]
+ OpenAIP => []
+ OneMapSG => [:Default, :Night, :Original, :Grey, :LandLot]
+ JusticeMap => [:income, :americanIndian, :asian, :black, :hispanic…
+ nlmaps => [:standaard, :pastel, :grijs, :water, :luchtfoto]
+ AzureMaps => [:MicrosoftImagery, :MicrosoftBaseDarkGrey, :Microso…
+ Esri => [:WorldStreetMap, :DeLorme, :WorldTopoMap, :WorldIma…
+ HERE => [:normalDay, :normalDayCustom, :normalDayGrey, :norm…
+ Stadia => [:AlidadeSmooth, :AlidadeSmoothDark, :OSMBright, :Ou…
+ MtbMap => []
+ ⋮ => ⋮
+
Try and see which ones work, and report back please.
+##london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
+##ptopo = TileProviders.USGS(:USTopo)
+##pclouds = TileProviders.OpenWeatherMap(:Clouds)
+##pbright = TileProviders.MapTiler(:Bright)
+##ppositron = TileProviders.CartoDB(:Positron)
+##providers = [ptopo, pclouds, pbright, ppositron]
+##m = Tyler.Map(london; provider=ppositron,
+# figure=Figure(resolution=(600, 600)))
+
This page was generated using Literate.jl.
using Tyler, GLMakie
+
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
+
Info
+London
+This page was generated using Literate.jl.
using Tyler, GLMakie
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using TileProviders
+using MapTiles
+using Downloads: download
+
+function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
+
+url = "https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv"
+d = download(url)
+whale = CSV.read(d, DataFrame)
+lon = whale[!, :lon]
+lat = whale[!, :lat]
+steps = size(lon,1)
+points = to_web_mercator.(lon,lat)
+
+lomn, lomx = extrema(lon)
+lamn, lamx = extrema(lat)
+δlon = abs(lomn - lomx)
+δlat = abs(lamn - lamx)
+
+provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+
+set_theme!(theme_black())
+m = Tyler.Map(Rect2f(Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat));
+ provider, figure=Figure(resolution=(1000, 600)))
+wait(m)
+
+nt = 30
+trail = CircularBuffer{Point2f}(nt)
+fill!(trail, points[1]) # add correct values to the circular buffer
+trail = Observable(trail) # make it an observable
+whale = Observable(points[1])
+
+c = to_color(:dodgerblue)
+trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail
+
+objline = lines!(m.axis, trail; color = trailcolor, linewidth=3)
+objscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered,
+ strokecolor=:grey90, strokewidth=1)
+hidedecorations!(m.axis)
+#limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))
+# the animation is done by updating the Observable values
+# change assets->(your folder) to make it work in your local env
+record(m.figure, joinpath("assets", "whale_shark_128786.mp4")) do io
+ for i in 2:steps
+ push!(trail[], points[i])
+ whale[] = points[i]
+ trail[] = trail[]
+ recordframe!(io) # record a new frame
+ end
+end
+set_theme!()
+
Info
+Whale shark movements in Gulf of Mexico.
+Contact person: Eric Hoffmayer
+This page was generated using Literate.jl.
A package for downloading map tiles on demand from different data source providers.
+Info
+In the Julia REPL type:
+using Pkg
+Pkg.add(["https://github.com/JuliaGeo/TileProviders.jl", "https://github.com/JuliaGeo/MapTiles.jl", "https://github.com/MakieOrg/Tyler.jl.git"])
+
or
+] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/JuliaGeo/MapTiles.jl https://github.com/MakieOrg/Tyler.jl.git
+
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
#
+Tyler.Interpolator
— Type.
Interpolator <: AbstractProvider
+
+Interpolator(f; colormap=:thermal, options=Dict(:minzoom=1, :maxzoom=19))
+
Provides tiles by interpolating them on the fly.
+f
: an Interpolations.jl interpolator or similar.colormap
: A Symbol
or Vector{RGBA{Float32}}
. Default is :thermal
.#
+Tyler.Map
— Type.
Map
+
+Map(extent, [extent_crs=wgs84]; kw...)
+
Tylers main object, it plots tiles onto a Makie.jl Axis
, downloading and plotting more tiles as you zoom and pan.
Arguments
+-extent
: the initial extent of the map, as a GeometryBasics.Rect
or an Extents.Extent
in the projection of extent_crs
. -extent_crs
: Any GeoFormatTypes
compatible crs, the default is wsg84.
Keywords
+-resolution
: The figure resolution. -figure
: an existing Makie.Figure
object. -crs
: The providers coordinate reference system. -provider
: a TileProviders.jl Provider
. -max_parallel_downloads
: limits the attempted simultaneous downloads, with a default of 16
. -cache_size_gb
: limits the cache for storing tiles, with a default of 5
. -depth
: the number of layers to load when zooming. Lower numbers will be slightly faster but have more artefacts. The default is 8
. -halo
: The fraction of the width of tiles to add as a halo so that panning is smooth - the tiles will already be loaded. The default is 0.2
, which means 0.1
on each side. -scale
: a tile scaling factor. Low number decrease the downloads but reduce the resolution. The default is 1.0
.
A package for downloading map tiles on demand from different data source providers.
Info
In the Julia REPL type:
using Pkg\nPkg.add([\"https://github.com/JuliaGeo/TileProviders.jl\", \"https://github.com/JuliaGeo/MapTiles.jl\", \"https://github.com/MakieOrg/Tyler.jl.git\"])\n
or
] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/JuliaGeo/MapTiles.jl https://github.com/MakieOrg/Tyler.jl.git\n
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
# Tyler.Interpolator
\u2014 Type.
Interpolator <: AbstractProvider\n\nInterpolator(f; colormap=:thermal, options=Dict(:minzoom=1, :maxzoom=19))\n
Provides tiles by interpolating them on the fly.
f
: an Interpolations.jl interpolator or similar.colormap
: A Symbol
or Vector{RGBA{Float32}}
. Default is :thermal
.source
# Tyler.Map
\u2014 Type.
Map\n\nMap(extent, [extent_crs=wgs84]; kw...)\n
Tylers main object, it plots tiles onto a Makie.jl Axis
, downloading and plotting more tiles as you zoom and pan.
Arguments
-extent
: the initial extent of the map, as a GeometryBasics.Rect
or an Extents.Extent
in the projection of extent_crs
. -extent_crs
: Any GeoFormatTypes
compatible crs, the default is wsg84.
Keywords
-resolution
: The figure resolution. -figure
: an existing Makie.Figure
object. -crs
: The providers coordinate reference system. -provider
: a TileProviders.jl Provider
. -max_parallel_downloads
: limits the attempted simultaneous downloads, with a default of 16
. -cache_size_gb
: limits the cache for storing tiles, with a default of 5
. -depth
: the number of layers to load when zooming. Lower numbers will be slightly faster but have more artefacts. The default is 8
. -halo
: The fraction of the width of tiles to add as a halo so that panning is smooth - the tiles will already be loaded. The default is 0.2
, which means 0.1
on each side. -scale
: a tile scaling factor. Low number decrease the downloads but reduce the resolution. The default is 1.0
.
source
"},{"location":"examples/generated/Contributors/Howto/","title":"Contribute to Documentation","text":""},{"location":"examples/generated/Contributors/Howto/#contribute-to-documentation","title":"Contribute to Documentation","text":"Contributing with examples can be done by first creating a new file example here
Info
your_new_file.jl
at docs/examples/UserGuide/
Once this is done you need to add a new entry here at the bottom and the appropiate level.
Info
Your new entry should look like:
\"Your title example\" : \"examples/generated/UserGuide/your_new_file.md\"
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/basic_features/","title":"Basic features: scatter, polygon and text","text":""},{"location":"examples/generated/UserGuide/basic_features/#basic-features-example","title":"Basic features example","text":""},{"location":"examples/generated/UserGuide/basic_features/#add-points-polygons-and-text-to-a-map","title":"Add points, polygons and text to a map","text":"load packages
using Tyler, GLMakie\nusing TileProviders\nusing MapTiles\nusing Extents\n\n# select a map provider\nprovider = TileProviders.Esri(:WorldImagery)\n# Plot a point on the map\n# point location to add to map\nlat = 34.2013;\nlon = -118.1714;\n# convert to point in web_mercator\npts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))\n# set how much area to map in degrees\ndelta = 1;\n# define Extent for display in web_mercator\nextent = Extent(X = (lon - delta/2, lon + delta/2), Y = (lat-delta/2, lat+delta/2));\n\n# show map\nm = Tyler.Map(extent; provider, figure=Figure(resolution=(1000, 600)))\n# wait for tiles to fully load\nwait(m)\n
Plot point on map
objscatter = scatter!(m.axis, pts; color = :red,\nmarker = '\u2b50', markersize = 50)\n# hide ticks, grid and lables\nhidedecorations!(m.axis)\n# hide frames\nhidespines!(m.axis)\n# Plot a plygon on the map\np1 = (lon-delta/8, lat-delta/8)\np2 = (lon-delta/8, lat+delta/8)\np3 = (lon+delta/8, lat+delta/8)\np4 = (lon+delta/8, lat-delta/8)\n\npolyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))\npolyg = Point2f.(polyg)\npoly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)\n\n# Add text\npts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))\ntext!(pts2, text = \"Basic Example\"; fontsize = 30,\ncolor = :darkblue, align = (:center, :center)\n)\n# show figure\nm\n
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/iceloss_ex/","title":"Ice loss animation","text":""},{"location":"examples/generated/UserGuide/iceloss_ex/#greenland-ice-loss-example-animated-interactive","title":"Greenland ice loss example: animated & interactive","text":"using Tyler\nusing GLMakie\nusing Arrow\nusing DataFrames\nusing TileProviders\nusing Extents\nusing Colors\nusing Dates\nusing HTTP\n\nurl = \"https://github.com/JuliaGeo/JuliaGeoData/blob/365a09596bfca59e0977c20c2c2f566c0b29dbaa/assets/data/iceloss_subset.arrow?raw=true\";\n\n# parameter for scaling figure size\nscale = 1;\n\n# load ice loss data [courtesy of Chad Greene @ JPL]\nresp = HTTP.get(url);\ndf = DataFrame(Arrow.Table(resp.body));\n\n# select map provider\nprovider = TileProviders.Esri(:WorldImagery);\n\n# Greenland extent\nextent = Extent(X = (-54., -48.), Y = (68.8, 72.5));\n\n# extract data\ncnt = [length(foo) for foo in df.X];\nX = reduce(vcat,df.X);\nY = reduce(vcat,df.Y);\nZ = [repeat([i],c) for (i, c) = enumerate(cnt)];\nZ = reduce(vcat,Z);\n\n# make color map\nnc = length(Makie.to_colormap(:thermal));\nn = nrow(df);\nalpha = zeros(nc);\nalpha[1:maximum([1,round(Int64,1*nc/n)])] = alpha[1:maximum([1,round(Int64,1*nc/n)])] .* (1.05^-1.5);\nalpha[maximum([1,round(Int64,1*nc/n)])] = 1;\ncmap = Colors.alphacolor.(Makie.to_colormap(:thermal), alpha);\ncmap = Observable(cmap);\n\n# show map\nm = Tyler.Map(extent; provider, figure=Figure(resolution=(1912 * scale, 2284 * scale)));\n\n# create initial scatter plot\nscatter!(m.axis, X, Y; color = Z, colormap = cmap, colorrange = [0, n], markersize = 10);\n\n# add color bar\na,b = extrema(df.Date);\na = year(a);\nb = year(b);\nColorbar(m.figure[1,2]; colormap = cmap, colorrange = [a,b], ticklabelsize = 50 * scale, width = 100 * scale);\n\n# hide ticks, grid and lables\nhidedecorations!(m.axis);\n\n# hide frames\nhidespines!(m.axis);\n\n# wait for tiles to fully load\nwait(m)\n
# ------ uncomment to create interactive-animated figure -----\n# The Documenter does not allow creations of interactive plots\n\n# loop to create animation\n
if interactive for k = 1:15 # reset apha alpha[:] = zeros(nc); cmap[] = Colors.alphacolor.(cmap[], alpha)
for i in 2:1:n\n # modify alpha\n alpha[1:maximum([1,round(Int64,i*nc/n)])] = alpha[1:maximum([1,round(Int64,i*nc/n)])] .* (1.05^-1.5);\n alpha[maximum([1,round(Int64,i*nc/n)])] = 1;\n cmap[] = Colors.alphacolor.(cmap[], alpha);\n sleep(0.001);\n end\nend\n
end
# -----------------------------------------------------------\n
Info
Ice loss from the Greenland Ice Sheet: 1972-2022.
Contact person: Alex Gardner & Chad Greene
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/interpolation/","title":"On The Fly Interpolation","text":""},{"location":"examples/generated/UserGuide/interpolation/#using-interpolation-on-the-fly","title":"Using Interpolation On The Fly","text":"using Tyler, GLMakie\nusing Interpolations: interpolate, Gridded, Linear\n\nf(lon,lat)=cosd(16*lon)+sind(16*lat)\n\nf_in_0_1_range(lon,lat)=0.5+0.25*f(lon,lat)\n\nnodes=(-180.0:180.0, -90.0:90.0)\narray=[f(lon,lat) for lon in nodes[1], lat in nodes[2]]\narray=(array.-minimum(array))./(maximum(array)-minimum(array))\nitp = interpolate(nodes, array, Gridded(Linear()))\ncols=Makie.to_colormap(:viridis)\ncol(i)=RGBAf(Makie.interpolated_getindex(cols,i))\nfun(x,y) = col(itp(x,y))\n\noptions = Dict(:min_zoom => 1,:max_zoom => 19)\np1 = Tyler.Interpolator(f_in_0_1_range; options)\np2 = Tyler.Interpolator(fun; options)\n\nb = Rect2f(-20.0, -20.0, 40.0, 40.0)\nm = Tyler.Map(b, provider=p1)\n
Info
Sine Waves
Tip
Try b = Rect2f(-180.0, -89.9, 360.0, 179.8)
Tip
interpolated_getindex
requires input i
to be in the 0-1 range
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/providers/","title":"Map Tile providers","text":""},{"location":"examples/generated/UserGuide/providers/#tile-providers","title":"Tile Providers","text":"using Tyler, GLMakie\nusing TileProviders\nusing MapTiles\n
Several providers are available (unfortunally is hard to find the ones that work properly). See the following list:
providers = TileProviders.list_providers()\n
Dict{Function, Vector{Symbol}} with 39 entries:\n SwissFederalGeoportal => [:NationalMapColor, :NationalMapGrey, :SWISSIMAGE]\n GeoportailFrance => [:plan, :parcels, :orthos]\n OpenSnowMap => [:pistes]\n Google => [:satelite, :roadmap, :terrain, :hybrid]\n OpenRailwayMap => []\n WaymarkedTrails => [:hiking, :cycling, :mtb, :slopes, :riding, :skating]\n NLS => []\n MapTilesAPI => [:OSMEnglish, :OSMFrancais, :OSMEspagnol]\n Stamen => [:Toner, :TonerBackground, :TonerHybrid, :TonerLines\u2026\n TomTom => [:Basic, :Hybrid, :Labels]\n OpenAIP => []\n OneMapSG => [:Default, :Night, :Original, :Grey, :LandLot]\n JusticeMap => [:income, :americanIndian, :asian, :black, :hispanic\u2026\n nlmaps => [:standaard, :pastel, :grijs, :water, :luchtfoto]\n AzureMaps => [:MicrosoftImagery, :MicrosoftBaseDarkGrey, :Microso\u2026\n Esri => [:WorldStreetMap, :DeLorme, :WorldTopoMap, :WorldIma\u2026\n HERE => [:normalDay, :normalDayCustom, :normalDayGrey, :norm\u2026\n Stadia => [:AlidadeSmooth, :AlidadeSmoothDark, :OSMBright, :Ou\u2026\n MtbMap => []\n \u22ee => \u22ee\n
Try and see which ones work, and report back please.
##london = Rect2f(-0.0921, 51.5, 0.04, 0.025)\n##ptopo = TileProviders.USGS(:USTopo)\n##pclouds = TileProviders.OpenWeatherMap(:Clouds)\n##pbright = TileProviders.MapTiler(:Bright)\n##ppositron = TileProviders.CartoDB(:Positron)\n##providers = [ptopo, pclouds, pbright, ppositron]\n##m = Tyler.Map(london; provider=ppositron,\n# figure=Figure(resolution=(600, 600)))\n
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/start/","title":"Basic demo","text":""},{"location":"examples/generated/UserGuide/start/#quick-start-into-tyler","title":"Quick start into Tyler","text":""},{"location":"examples/generated/UserGuide/start/#a-basic-request","title":"A basic request","text":"using Tyler, GLMakie\n\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))\n
Info
London
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/whale_ex/","title":"Whale shark trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#whale-shark-exampe-trajectory","title":"Whale shark exampe trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#using-the-full-stack-of-makie-should-just-work","title":"Using the full stack of Makie should just work.","text":"using Tyler, GLMakie\nusing CSV, DataFrames\nusing DataStructures: CircularBuffer\nusing TileProviders\nusing MapTiles\nusing Downloads: download\n\nfunction to_web_mercator(lo,lat)\nreturn Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))\nend\n\nurl = \"https://raw.githubusercontent.com/MakieOrg/Tyler.jl/master/docs/src/assets/data/whale_shark_128786.csv\"\nd = download(url)\nwhale = CSV.read(d, DataFrame)\nlon = whale[!, :lon]\nlat = whale[!, :lat]\nsteps = size(lon,1)\npoints = to_web_mercator.(lon,lat)\n\nlomn, lomx = extrema(lon)\nlamn, lamx = extrema(lat)\n\u03b4lon = abs(lomn - lomx)\n\u03b4lat = abs(lamn - lamx)\n\nprovider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)\n\nset_theme!(theme_black())\nm = Tyler.Map(Rect2f(Rect2f(lomn - \u03b4lon/2, lamn-\u03b4lat/2, 2\u03b4lon, 2\u03b4lat));\nprovider, figure=Figure(resolution=(1000, 600)))\nwait(m)\n\nnt = 30\ntrail = CircularBuffer{Point2f}(nt)\nfill!(trail, points[1]) # add correct values to the circular buffer\ntrail = Observable(trail) # make it an observable\nwhale = Observable(points[1])\n\nc = to_color(:dodgerblue)\ntrailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail\n\nobjline = lines!(m.axis, trail; color = trailcolor, linewidth=3)\nobjscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered,\nstrokecolor=:grey90, strokewidth=1)\nhidedecorations!(m.axis)\n#limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))\n# the animation is done by updating the Observable values\n# change assets->(your folder) to make it work in your local env\nrecord(m.figure, joinpath(\"assets\", \"whale_shark_128786.mp4\")) do io\nfor i in 2:steps\npush!(trail[], points[i])\nwhale[] = points[i]\ntrail[] = trail[]\nrecordframe!(io) # record a new frame\nend\nend\nset_theme!()\n
Info
Whale shark movements in Gulf of Mexico.
Contact person: Eric Hoffmayer
This page was generated using Literate.jl.
"}]} \ No newline at end of file diff --git a/previews/PR53/siteinfo.js b/previews/PR53/siteinfo.js new file mode 100644 index 00000000..c4dd22ad --- /dev/null +++ b/previews/PR53/siteinfo.js @@ -0,0 +1 @@ +var DOCUMENTER_CURRENT_VERSION = "previews/PR53"; diff --git a/previews/PR53/sitemap.xml b/previews/PR53/sitemap.xml new file mode 100644 index 00000000..0f8724ef --- /dev/null +++ b/previews/PR53/sitemap.xml @@ -0,0 +1,3 @@ + +using Tyler, GLMakie
+
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
+
Info
+London
+This page was generated using Literate.jl.
+ + + + + + +using Tyler, GLMakie
+using CSV, DataFrames
+using DataStructures: CircularBuffer
+using TileProviders
+using MapTiles
+
+function to_web_mercator(lo,lat)
+ return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
+end
+
+provider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)
+m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025), 5;
+ provider, min_tiles=8, max_tiles=16)
+
Rect2f(lomn - δlon/2, lamn-δlat/2, 2δlon, 2δlat)
+whale = CSV.read("./examples/data/whaleshark128786.csv", DataFrame) lon = whale[!, :lon] lat = whale[!, :lat] steps = size(lon,1)
+points = towebmercator.(lon,lat)
+lomn, lomx = extrema(lon) lamn, lamx = extrema(lat) δlon = abs(lomn - lomx) δlat = abs(lamn - lamx)
+nt = 30 trail = CircularBuffer{Point2f}(nt) fill!(trail, points[1]) # add correct values to the circular buffer trail = Observable(trail) # make it an observable whale = Observable(points[1])
+c = to_color(:dodgerblue) trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail wait(m)
+objline = lines!(m.axis, trail; color = trailcolor, linewidth=3) objscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered, strokecolor=:grey90, strokewidth=1) hidedecorations!(m.axis) translate!(objline, 0, 0, 2) translate!(objscatter, 0, 0, 2) #limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))
+ + +record(m.figure, joinpath("assets", "whaleshark128786.mp4")) do io for i in 2:steps push!(trail[], points[i]) whale[] = points[i] trail[] = trail[] recordframe!(io) # record a new frame end end
+Info
+Whale shark movements in Gulf of Mexico. Contact person: Eric Hoffmayer
+# ![type:video](./assets/whale_shark_128786.mp4)
+
This page was generated using Literate.jl.
+ + + + + + +A package for downloading map tiles on demand from different data source providers.
+Info
+In the Julia REPL type:
+using Pkg
+Pkg.add(["https://github.com/JuliaGeo/TileProviders.jl", "https://github.com/SimonDanisch/MapTiles.jl.git", "https://github.com/MakieOrg/Tyler.jl.git"])
+
or
+] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git
+
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
A package for downloading map tiles on demand from different data source providers.
Info
In the Julia REPL type:
using Pkg\nPkg.add([\"https://github.com/JuliaGeo/TileProviders.jl\", \"https://github.com/SimonDanisch/MapTiles.jl.git\", \"https://github.com/MakieOrg/Tyler.jl.git\"])\n
or
] add https://github.com/JuliaGeo/TileProviders.jl https://github.com/SimonDanisch/MapTiles.jl.git https://github.com/MakieOrg/Tyler.jl.git\n
The ]
character starts the Julia package manager. Hit backspace key to return to Julia prompt.
using Tyler, GLMakie\n\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))\n
Info
London
This page was generated using Literate.jl.
"},{"location":"examples/generated/UserGuide/whale_ex/","title":"Whale shark trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#whale-shark-exampe-trajectory","title":"Whale shark exampe trajectory","text":""},{"location":"examples/generated/UserGuide/whale_ex/#using-the-full-stack-of-makie-should-just-work","title":"Using the full stack of Makie should just work.","text":"using Tyler, GLMakie\nusing CSV, DataFrames\nusing DataStructures: CircularBuffer\nusing TileProviders\nusing MapTiles\n\nfunction to_web_mercator(lo,lat)\nreturn Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))\nend\n\nprovider = TileProviders.NASAGIBS(:ViirsEarthAtNight2012)\nm = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025), 5;\nprovider, min_tiles=8, max_tiles=16)\n
Rect2f(lomn - \u03b4lon/2, lamn-\u03b4lat/2, 2\u03b4lon, 2\u03b4lat)
whale = CSV.read(\"./examples/data/whaleshark128786.csv\", DataFrame) lon = whale[!, :lon] lat = whale[!, :lat] steps = size(lon,1)
points = towebmercator.(lon,lat)
lomn, lomx = extrema(lon) lamn, lamx = extrema(lat) \u03b4lon = abs(lomn - lomx) \u03b4lat = abs(lamn - lamx)
nt = 30 trail = CircularBuffer{Point2f}(nt) fill!(trail, points[1]) # add correct values to the circular buffer trail = Observable(trail) # make it an observable whale = Observable(points[1])
c = to_color(:dodgerblue) trailcolor = [RGBAf(c.r, c.g, c.b, (i/nt)^2.5) for i in 1:nt] # fading tail wait(m)
objline = lines!(m.axis, trail; color = trailcolor, linewidth=3) objscatter = scatter!(m.axis, whale; markersize = 15, color = :orangered, strokecolor=:grey90, strokewidth=1) hidedecorations!(m.axis) translate!(objline, 0, 0, 2) translate!(objscatter, 0, 0, 2) #limits!(ax, minimum(lon), maximum(lon), minimum(lat), maximum(lat))
"},{"location":"examples/generated/UserGuide/whale_ex/#the-animation-is-done-by-updating-the-observable-values","title":"the animation is done by updating the Observable values","text":""},{"location":"examples/generated/UserGuide/whale_ex/#change-assets-your-folder-to-make-it-work-in-your-local-env","title":"change assets->(your folder) to make it work in your local env","text":"record(m.figure, joinpath(\"assets\", \"whaleshark128786.mp4\")) do io for i in 2:steps push!(trail[], points[i]) whale[] = points[i] trail[] = trail[] recordframe!(io) # record a new frame end end
Info
Whale shark movements in Gulf of Mexico. Contact person: Eric Hoffmayer
# ![type:video](./assets/whale_shark_128786.mp4)\n
This page was generated using Literate.jl.
"}]} \ No newline at end of file diff --git a/previews/PR6/siteinfo.js b/previews/PR6/siteinfo.js new file mode 100644 index 00000000..14970df9 --- /dev/null +++ b/previews/PR6/siteinfo.js @@ -0,0 +1 @@ +var DOCUMENTER_CURRENT_VERSION = "previews/PR6"; diff --git a/previews/PR6/sitemap.xml b/previews/PR6/sitemap.xml new file mode 100644 index 00000000..362c0af2 --- /dev/null +++ b/previews/PR6/sitemap.xml @@ -0,0 +1,18 @@ + +{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Wa=/["'&<>]/;Vn.exports=Ua;function Ua(e){var t=""+e,r=Wa.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i