To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 30 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Download the notebook:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Open the notebook file

    Type the saved filename in the open box.

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
begin
using PlutoPlotly
using CountriesBorders
using PlutoTest
end
2.7 s
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 48.864°
└─ lon: 2.349°
👀 Reading hidden code
begin
rome = LatLon(41.9, 12.49) # Rome, Italy
catania = LatLon(37.5, 15.09) # Catania, Sicily
madrid = LatLon(40.416, -3.703) # Madrid, Spain
paris = LatLon(48.864, 2.349) # Paris, France
end
49.5 μs
2 view(::GeometrySet{CountryBorder{Float32}}, resolution = 110m, [133, 142])
├─ Spain
└─ Italy (1 skipped)
👀 Reading hidden code
dmn = extract_countries("italy; spain"; skip_areas= [
("Italy", 2) # This will skip Sicily, which is the second PolyArea in the Italian country
])
1.1 s
rome ∈ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 41.9°
└─ lon: 12.49°
∈ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 41.9°
└─ lon: 12.49°
2 view(::GeometrySet{CountryBorder{Float32}}, resolution = 110m, [133, 142])
├─ Spain
└─ Italy (1 skipped)
true
@test rome ∈ dmn
👀 Reading hidden code
1.9 ms
madrid ∈ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 40.416°
└─ lon: -3.703°
∈ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 40.416°
└─ lon: -3.703°
2 view(::GeometrySet{CountryBorder{Float32}}, resolution = 110m, [133, 142])
├─ Spain
└─ Italy (1 skipped)
true
@test madrid ∈ dmn
👀 Reading hidden code
1.7 ms
catania ∉ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 37.5°
└─ lon: 15.09°
∉ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 37.5°
└─ lon: 15.09°
2 view(::GeometrySet{CountryBorder{Float32}}, resolution = 110m, [133, 142])
├─ Spain
└─ Italy (1 skipped)
true
@test catania ∉ dmn
👀 Reading hidden code
56.0 μs
paris ∉ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 48.864°
└─ lon: 2.349°
∉ dmn
GeodeticLatLon{WGS84Latest} coordinates
├─ lat: 48.864°
└─ lon: 2.349°
2 view(::GeometrySet{CountryBorder{Float32}}, resolution = 110m, [133, 142])
├─ Spain
└─ Italy (1 skipped)
true
@test paris ∉ dmn
👀 Reading hidden code
32.7 μs
let
# scattergeo on the output of extract_countries will plot the borders of the countries in the extracte region as lines. all kwargs passed to scattergeo will be forwarded to the internal call to scattergeo with extracted lat and lon
region = scattergeo(dmn; line_color = "blue", line_width = 1, name = "Extracted Region")
# Calls to scattergeo with a vector of SimpleLatLon elements will plot those directly (without explicitly setting `mode` kwarg, so it will default to just markers for limited number of points)
excluded = scattergeo([catania, paris]; marker_symbol = "x", marker_color = "red", name = "Excluded Cities")
included = scattergeo([rome, madrid]; marker_symbol = ".", name = "Included Cities")
data = [region, excluded, included]
plot(data, Layout(;
geo = attr(;
lataxis = attr(;
range = [25, 70],
showgrid = true,
dtick = 10,
),
lonaxis = attr(;
range = [-35, 55],
showgrid = true,
),
),
legend = attr(;
x = .95,
xanchor = "right",
y = .95,
)
))
end
👀 Reading hidden code
213 μs