Skip to content

Commit

Permalink
compat and fix tests (#24)
Browse files Browse the repository at this point in the history
* Update Project.toml

* stamen -> stadia

* Create api.md

* Update index.md

* Update make.jl

* add dummy api key

* fix tests since GADM update borked the syntax

* Update test/runtests.jl

* Update runtests.jl

* Work around super clumsy GADM syntax for now

* Update index.md

* Update api.md
  • Loading branch information
asinghvi17 authored Aug 31, 2024
1 parent 569d1c3 commit acc6850
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Leaflet"
uuid = "2ed2781b-9bfa-45ba-823d-d31db75b7d93"
authors = ["Yeesian Ng <[email protected]>, Rafael Schouten <[email protected]>"]
version = "0.1.0"
version = "0.1.1"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -15,7 +15,7 @@ WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"
[compat]
Colors = "0.12"
GeoInterface = "1"
GeoJSON = "0.6"
GeoJSON = "0.6, 0.7, 0.8"
JSON3 = "1"
TileProviders = "0.1.0"
WebIO = "0.8"
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ makedocs(;
),
pages=[
"Home" => "index.md",
"API" => "api.md",
],
)

Expand Down
11 changes: 11 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# API

```@index
```

```@autodocs
Modules = [Leaflet]
```
```@docs
Leaflet.Provider
```
14 changes: 9 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ CurrentModule = Leaflet

# Leaflet

Documentation for [Leaflet](https://github.com/JuliaGeo/Leaflet.jl).
Documentation for [Leaflet](https://github.com/JuliaGeo/Leaflet.jl). See the API spec in [the API page](@ref API).

```@index
```
## Quick start

```@autodocs
Modules = [Leaflet]
```julia
using Leaflet, Blink, GADM, GeoInterface
layers = Leaflet.Layer.([GADM.get("CHN"), GADM.get("JPN")] .|> x -> GeoInterface.getfeature(x, 1) .|> GeoInterface.geometry; color=:orange);
provider = Providers.CartoDB()
m = Leaflet.Map(; layers, provider, zoom=3, height=1000, center=[30.0, 120.0]);
w = Blink.Window(; body=m)
```
![](https://user-images.githubusercontent.com/4471859/275353261-0b1aa078-be0f-443c-a5d8-fc27a9a66cef.png)

## EarthEngine Example

Expand Down
10 changes: 6 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using GADM
using Leaflet
using Test
using WebIO
using Leaflet: Providers
using Leaflet.GeoInterface

providers = (
Providers.OpenStreetMap(),
Expand All @@ -10,14 +12,14 @@ providers = (
Providers.OpenTopoMap(),
Providers.CartoDB(:DarkMatterNoLabels),
Providers.Esri(),
Providers.Stamen(),
Providers.Stamen(:Watercolor),
Providers.Stadia(:StamenToner),
Providers.Stadia(:StamenWatercolor),
Providers.CartoDB(:DarkMatter),
Providers.Google(:hybrid),
Providers.MapBox(; accesstoken="sometoken"),
Providers.Jawg(; accesstoken="sometoken"),
Providers.Thunderforest(; apikey="someapikey"),
Providers.OpenWeatherMap(:Clouds),
Providers.OpenWeatherMap(:Clouds; apikey="some_apikey"),
Providers.NASAGIBS(:ViirsEarthAtNight2012),
Providers.Provider("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"),
)
Expand All @@ -27,7 +29,7 @@ providers = (
# actually works in a browser is a much bigger task.
for provider in providers
# Make a country outline Layer
layers = Leaflet.Layer(GADM.get("MUS").geom[1];
layers = Leaflet.Layer((GeoInterface.geometry(GeoInterface.getfeature(GADM.get("MUS"), 1)));
color="#ff0201",
opacity=0.6,
fill_opacity=0.2
Expand Down

0 comments on commit acc6850

Please sign in to comment.