I wish to plot a simple map of some EU country and superpose dots and lines ; This is supposedly simple, but alas - it doesnt work for me .
# For plots
using Tyler
using GLMakie
using GeoMakie
using Tyler.TileProviders
using Tyler.MapTiles
using Tyler.Extents
#
long = [40.4483, 40.4079]
latt = [-3.88463, -3.90931]
# Start plotting
GLMakie.activate!(inline=false)
# Création de la figure
fig = Figure(; size = (800, 600))
#display(fig, px_per_unit = 2)
# Ajout de l'arrière-plan de la carte avec Tyler
ax = Axis(fig[1, 1]) #, title = "Spain map")
prov = Esri(:WorldImagery)
extent = Rect2f(-9, 35, 13, 10) #
# Charger les tuiles de la carte
tm = Tyler.Map(extent; provider=prov, figure=fig, axis=ax);
pts = Point2f(MapTiles.project((long,latt), MapTiles.wgs84, MapTiles.web_mercator))
objscatter = scatter!(tm.axis, pts; color = :red, markersize = 5, marker = :circle)
I have Tyler version v0.1.5 - the 0.2.0 version seems to have some conflict:
Pkg.add(PackageSpec(name="Tyler", version="0.2.0"))
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package PointClouds [3cc211ed]:
PointClouds [3cc211ed] log:
├─possible versions are: 0.3.0-0.4.0 or uninstalled
├─restricted by julia compatibility requirements to versions: uninstalled
└─restricted by compatibility requirements with Tyler [e170d443] to versions: 0.3.0-0.3.1 — no versions left
└─Tyler [e170d443] log:
├─possible versions are: 0.1.0-0.2.0 or uninstalled
└─restricted to versions 0.2.0 by an explicit requirement, leaving only versions: 0.2.0
I used GMT before, but for some reason that stopped plotting anything without changing either my code or data ; This is why I turned to GLMakie / Tyler
the issue is the MapTiles.project function, that only works for pairs of points, not arrays. But even doing that, the marker is being hidden, this doesn’t fail now, but we don’t see the marker, something broke this recently @sdanisch ?
using GLMakie
GLMakie.activate!()
# using GeoMakie
using Tyler
using Tyler.TileProviders
using Tyler.MapTiles
using Tyler.Extents
#
latt = [40.4483, 40.4079]
long = [-3.90931, -3.88463]
function to_web_mercator(lo,lat)
return Point2f(MapTiles.project((lo,lat), MapTiles.wgs84, MapTiles.web_mercator))
end
pts = to_web_mercator.(long,latt)
fig = Figure(; size = (800, 600))
#display(fig, px_per_unit = 2)
# Ajout de l'arrière-plan de la carte avec Tyler
ax = Axis(fig[1, 1]) #, title = "Spain map")
prov = Esri(:WorldImagery)
extent = Rect2f(-9, 35, 13, 10) #
# lon, lat, delta, delta
# Charger les tuiles de la carte
tm = Tyler.Map(extent; provider=prov, figure=fig, axis=ax);
objscatter = scatter!(ax, pts; color = :red,
marker = '⭐', markersize = 50)
translate!(objscatter, 0, 0, 2)
# limits!(ax, Rect2f(data_limits(objscatter)))
fig
try: limits!(ax, Rect2f(data_limits(objscatter))) and it will take you outside the map… Which makes sense since the values are outside the extend from the beginning!
I took exactly the code above, and it does not work:
# For plots
using GLMakie
GLMakie.activate!()
using Tyler
using Tyler.TileProviders
using Tyler.MapTiles
using Tyler.Extents
#
long = [40.4483, 40.4079]
latt = [-3.88463, -3.90931]
function to_web_mercator(lat,lo)
return Point2f(MapTiles.project((lat,lo), MapTiles.wgs84, MapTiles.web_mercator))
end
pts = to_web_mercator.(latt,long)
# Création de la figure
fig = Figure(; size = (800, 600))
# Ajout de l'arrière-plan de la carte avec Tyler
ax = Axis(fig[1, 1]) #, title = "Spain map")
prov = Esri(:WorldImagery)
extent = Rect2f(-9, 35, 13, 10) #
# Charger les tuiles de la carte
tm = Tyler.Map(extent; provider=prov, figure=fig, axis=ax);
objscatter = scatter!(ax, pts; color = :red, marker = '⭐', markersize = 50)
translate!(objscatter, 0, 0, 2)
limits!(ax, Rect2f(data_limits(objscatter)))
fig
I dont ; Pkg.update(“Tyler”) keeps met at 0.1.5 ; what must be done to move it to 0.2.0 ?
Pkg.add(Pkg.PackageSpec(name="Tyler", version="0.2.0"))
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package PointClouds [3cc211ed]:
PointClouds [3cc211ed] log:
├─possible versions are: 0.3.0-0.4.0 or uninstalled
├─restricted by julia compatibility requirements to versions: uninstalled
└─restricted by compatibility requirements with Tyler [e170d443] to versions: 0.3.0-0.3.1 — no versions left
└─Tyler [e170d443] log:
├─possible versions are: 0.1.0-0.2.0 or uninstalled
└─restricted to versions 0.2.0 by an explicit requirement, leaving only versions: 0.2.0
But
Pkg.add("PointClouds")
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package PointClouds [3cc211ed]:
PointClouds [3cc211ed] log:
├─possible versions are: 0.3.0-0.4.0 or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions: 0.3.0-0.4.0
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
I can not remove this PointClouds package either nor update ;