Skip to content

Commit

Permalink
add Map3d for 3d tiling (#95)
Browse files Browse the repository at this point in the history
* refactor for 3d scenes

* work in progress

* move things to one type again and dispatch on axis

* refactor to dispatch on Axis parameter

* refactor everything

* fix missing and blank tiles and introduce plot limit

* fixes

* add download_threads option

* improve smoothness and fix bugs

* add downloader API, fix bugs + smoothness + use scratch for download cache

* polish and fixes

* try to fix float32 problems and find elevation provider artifacts

* start using our own camera and fix elevation provider

* cleanup

* improve camera, add docs, clean up

* fixes docs, interpolation.md fails

* Update src/tiles.jl

Co-authored-by: Anshul Singhvi <[email protected]>

* cleanup + make things work with old makie

* update docs

* fix hang for nthreads=1, clean up + docs

* fix them hangs

* fix ci, switch to bin for mapping

* fix tests

* bring back ax, aspect ratio example

* does it hang also without map 3d?

* nope, we need a mwe, maybe just london

* clean up, fix tests + logging for docs

* fix hangs and ci

* fix xvfb hopefully

* Update whale_shark.md

* remove one more output image

* small improvements and fixes

* go back to 5gb

* small improvements and stability fixes

* fix 2d case

---------

Co-authored-by: Lazaro Alonso <[email protected]>
Co-authored-by: Anshul Singhvi <[email protected]>
  • Loading branch information
3 people authored Aug 13, 2024
1 parent a57f718 commit bc114fd
Show file tree
Hide file tree
Showing 35 changed files with 2,190 additions and 598 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ permissions:
id-token: write
statuses: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
# Cancel previous runs if a new one is triggered (by push on PR)
concurrency:
group: pages
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -51,4 +50,4 @@ jobs:
JULIA_DEBUG: "Documenter"
DATADEPS_ALWAYS_ACCEPT: true
run: |
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ --color=yes docs/make.jl
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ --color=yes docs/make.jl
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
jobs:
test:
name: Tests
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
DISPLAY: ':0'
steps:
Expand All @@ -25,9 +25,7 @@ jobs:
version: 1
arch: x64
- uses: julia-actions/cache@v2
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
- name: Install pkgs dependencies
run: xvfb-run -s '-screen 0 1024x768x24' julia --project=@. -e 'using Pkg; pkg"add https://github.com/JuliaGeo/TileProviders.jl https://github.com/JuliaGeo/MapTiles.jl"'
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev xsettingsd x11-xserver-utils
- uses: julia-actions/julia-runtest@v1
with:
prefix: xvfb-run -s '-screen 0 1024x768x24'
prefix: xvfb-run -s '-screen 0 1024x768x24'
15 changes: 14 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@ authors = ["SimonDanisch <[email protected]>", "Lazaro Alonso <lazarus.alon@gma
version = "0.1.5"

[deps]
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
GeometryOps = "3251bfac-6a57-4b6d-aa61-ac1fef2975ab"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
LRUCache = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
MapTiles = "fea52e5a-b371-463b-85f5-81770daa2737"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PointClouds = "3cc211ed-1f43-4d33-a894-629186066e97"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
ThreadSafeDicts = "4239201d-c60e-5e0a-9702-85d713665ba7"
TileProviders = "263fe934-28e1-4ae9-998a-c2629c5fede6"

Expand All @@ -25,11 +36,13 @@ GeometryBasics = "0.4"
HTTP = "1"
LRUCache = "1"
LinearAlgebra = "1"
Makie = "0.20, 0.21"
Makie = "0.21"
MapTiles = "1"
OrderedCollections = "1"
ThreadSafeDicts = "0.1"
TileProviders = "0.1"
ImageIO = "0.6"
FileIO = "1"
julia = "1"

[extras]
Expand Down
6 changes: 3 additions & 3 deletions docs/logo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mars = Provider("https://api.nasa.gov/mars-wmts/catalog/Mars_Viking_MDIM21_ClrMo
moon = Provider("https://trek.nasa.gov/tiles/Moon/EQ/LRO_WAC_Mosaic_Global_303ppd_v02/1.0.0/default/default028mm/{z}/{y}/{x}.jpg")

mexico = Rect2f(-99.20618766110033, 19.425887652841997, 0.03, 0.02)
provider = TileProviders.OpenTopoMap()
provider = TileProviders.OpenStreetMap(:Mapnik)

fig1 = Figure(; figure_padding=0, size= (600,600))
ax1 = Axis(fig1[1,1]; ygridcolor=:silver, xgridcolor=:white,
Expand All @@ -31,7 +31,7 @@ hidespines!(ax1)
img_berlin = copy(Makie.colorbuffer(fig2))

london = Rect2f(-0.0921, 51.5, 0.04, 0.025)
provider = TileProviders.OpenTopoMap()
provider = TileProviders.OpenStreetMap(:Mapnik)
fig3 = Figure(; figure_padding=0, size= (600,600))
ax1 = Axis(fig3[1,1]; ygridcolor=:silver, xgridcolor=:white,
xgridwidth=2, ygridwidth=2)
Expand Down Expand Up @@ -64,4 +64,4 @@ end
mkpath(joinpath(@__DIR__, "src", "assets"))
#save(joinpath(@__DIR__, "src", "assets", "logo_raw.svg"), fig; pt_per_unit=0.75)
save(joinpath(@__DIR__, "src", "assets", "logo_raw.png"), fig; px_per_unit=2)
#save(joinpath(@__DIR__, "src", "assets", "favicon_raw.png"), fig; px_per_unit=0.25)
#save(joinpath(@__DIR__, "src", "assets", "favicon_raw.png"), fig; px_per_unit=0.25)
11 changes: 3 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ using Documenter, DocumenterVitepress
using Tyler
using Logging

Logging.disable_logging(Logging.Warn)

makedocs(;
sitename="Tyler",
modules=[Tyler],
Expand All @@ -17,18 +15,15 @@ makedocs(;
devurl="dev";
),
draft=false,
source="src",
build="build",
source="src",
build="build",
warnonly=true,
)

# Enable logging to console again
Logging.disable_logging(Logging.BelowMinLevel)

deploydocs(;
repo="github.com/MakieOrg/Tyler.jl.git",
target="build", # this is where Vitepress stores its output
branch = "gh-pages",
devbranch="master",
push_preview = true
)
)
145 changes: 80 additions & 65 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,89 @@ import footnote from "markdown-it-footnote";

// https://vitepress.dev/reference/site-config
export default defineConfig({
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
title: "Tyler",
description: "Maps",
lastUpdated: true,
cleanUrls: true,
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
head: [['link', { rel: 'icon', href: '/public/favicon.ico' }]],
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
title: "Tyler",
description: "Maps",
lastUpdated: true,
cleanUrls: true,
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
head: [["link", { rel: "icon", href: "/public/favicon.ico" }]],

markdown: {
math: true,
config(md) {
md.use(tabsMarkdownPlugin),
md.use(mathjax3),
md.use(footnote)
markdown: {
math: true,
config(md) {
md.use(tabsMarkdownPlugin), md.use(mathjax3), md.use(footnote);
},
theme: {
light: "github-light",
dark: "github-dark",
},
},
theme: {
light: "github-light",
dark: "github-dark"}
},

themeConfig: {
outline: 'deep',
// https://vitepress.dev/reference/default-theme-config
logo: { src: '/logo.png', width: 24, height: 24 },
search: {
provider: 'local',
options: {
detailedView: true
}
},
nav: [
{ text: 'Home', link: '/' },
{ text: 'Getting Started', link: '/getting_started' },
{ text: 'Examples',
items: [
{ text: 'Points, Poly & text', link: '/points_poly_text' },
{ text: 'OpenStreetMap data', link: '/osmmakie' },
{ text: 'Whale shark trajectory', link: '/whale_shark' },
{ text: 'Ice loss animation', link: '/iceloss_ex' },
{ text: 'Interpolation On The Fly', link: '/interpolation' },
]
},
themeConfig: {
outline: "deep",
// https://vitepress.dev/reference/default-theme-config
logo: { src: "/logo.png", width: 24, height: 24 },
search: {
provider: "local",
options: {
detailedView: true,
},
},
nav: [
{ text: "Home", link: "/" },
{ text: "Getting Started", link: "/getting_started" },
{
text: "Examples",
items: [
{ text: "Points, Poly & text", link: "/points_poly_text" },
{ text: "OpenStreetMap data", link: "/osmmakie" },
{ text: "Whale shark trajectory", link: "/whale_shark" },
{ text: "Ice loss animation", link: "/iceloss_ex" },
{
text: "Interpolation On The Fly",
link: "/interpolation",
},
{
text: "Map3D",
link: "/map-3d",
},
],
},

{ text: "API", link: "/api" },
],

{ text: 'API', link: '/api' }
],
sidebar: [
{
text: "Getting Started",
link: "/getting_started",
items: [
{ text: "Points, Poly & text", link: "/points_poly_text" },
{ text: "OpenStreetMap data", link: "/osmmakie" },
{ text: "Whale shark trajectory", link: "/whale_shark" },
{ text: "Ice loss animation", link: "/iceloss_ex" },
{
text: "Interpolation On The Fly",
link: "/interpolation",
},
{ text: "Map3D", link: "/map-3d" },

sidebar: [
{
text: 'Getting Started', link: '/getting_started',
items: [
{ text: 'Points, Poly & text', link: '/points_poly_text' },
{ text: 'OpenStreetMap data', link: '/osmmakie' },
{ text: 'Whale shark trajectory', link: '/whale_shark' },
{ text: 'Ice loss animation', link: '/iceloss_ex' },
{ text: 'Interpolation On The Fly', link: '/interpolation' },
{ text: 'API', link: '/api' }
]
}
],
editLink: {
pattern: 'https://github.com/MakieOrg/Tyler.jl/edit/master/docs/src/:path'
{ text: "API", link: "/api" },
],
},
],
editLink: {
pattern:
"https://github.com/MakieOrg/Tyler.jl/edit/master/docs/src/:path",
},
socialLinks: [
{ icon: "github", link: "https://github.com/MakieOrg/Tyler.jl" },
],
footer: {
message:
'Made with <a href="https://luxdl.github.io/DocumenterVitepress.jl/" target="_blank"><strong>DocumenterVitepress.jl</strong></a> <br>',
copyright: `© Copyright ${new Date().getUTCFullYear()}. Released under the MIT License.`,
},
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/MakieOrg/Tyler.jl' }
],
footer: {
message: 'Made with <a href="https://luxdl.github.io/DocumenterVitepress.jl/" target="_blank"><strong>DocumenterVitepress.jl</strong></a> <br>',
copyright: `© Copyright ${new Date().getUTCFullYear()}. Released under the MIT License.`
}
}
})
});
Binary file added docs/src/assets/alpine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/src/assets/data/logo.png
Binary file not shown.
File renamed without changes
File renamed without changes.
Binary file added docs/src/assets/pointclouds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 5 additions & 17 deletions docs/src/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In the Julia REPL type:
```
The `]` character starts the Julia [package manager](https://docs.julialang.org/en/v1/stdlib/Pkg/). Hit backspace key to return to Julia prompt.

Or, explicitly use `Pkg`
Or, explicitly use `Pkg`

```julia
using Pkg
Expand All @@ -25,12 +25,8 @@ Pkg.add(["Tyler.jl"])
````@example london
using Tyler, GLMakie
m = Tyler.Map(Rect2f(-0.0921, 51.5, 0.04, 0.025))
wait(m)
save("london.png", current_figure()) # hide
nothing # hide
````

![](london.png)

::: info

Expand All @@ -46,21 +42,17 @@ We can use a different tile provider as well as any style `theme` from Makie as
using GLMakie, Tyler
using Tyler.TileProviders
provider = TileProviders.OpenTopoMap()
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)
wait(m)
m
end
save("londonProvider.png", current_figure()) # hide
nothing # hide
````

![](londonProvider.png)

## Providers list

More providers are available. See the following list:
Expand Down Expand Up @@ -91,15 +83,11 @@ 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)
wait(m)
fig
end
save("londonFigure.png", current_figure()) # hide
nothing # hide
````

![](londonFigure.png)

Next, we could add any other plot type on top of the `ax` axis defined above.
Next, we could add any other plot type on top of the `ax` axis defined above.
Loading

0 comments on commit bc114fd

Please sign in to comment.