👀 Reading hidden code
begin
using PlutoPlotly
using CountriesBorders
using PlutoTest
end
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
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
])
@test rome ∈ dmn
👀 Reading hidden code
@test madrid ∈ dmn
👀 Reading hidden code
@test catania ∉ dmn
👀 Reading hidden code
@test paris ∉ dmn
👀 Reading hidden code
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