Need Help with Tyler.jl

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)

Produces the error:

ERROR: MethodError: no method matching getindex(::typeof(Makie.Combined))
Stacktrace:
 [1] Tyler.Map(extent::GeometryBasics.HyperRectangle{2, Float32}, extent_crs::MapTiles.WGS84; resolution::Tuple{Int64, Int64}, figure::Figure, axis::Axis, provider::Provider, crs::MapTiles.WebMercator, max_parallel_downloads::Int64, cache_size_gb::Int64, depth::Int64, halo::Float64, scale::Float64, max_zoom::Int64)
   @ Tyler C:\Users\XXYXYXYX\.julia\packages\Tyler\u3wcB\src\Tyler.jl:141
 [2] top-level scope
   @test.jl:26

Looks like an old tyler version.

Two things that in error. 1) lon and lat are swapped. 2) Minimum latitude is greater than max latitude.
With GMT that gives Bing images by default

using GMT

I = mosaic([-3.90931, -3.88463], [40.4079, 40.4483])
viz(I)

A low res image of the above.

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

Swapping them resulted in the same error ;

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

One normally open issues in the package site to try to fix whatever error is causing that behavior.

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

edit: lon and lat were reversed :frowning: , now all is fine :smiley:

I think the marker thing might be this issue I recently encountered:

yes, it works for the example in the docs, but weirdly enough not for this case… so, it seems like something buggy is actually happening here.

It did look to my, like the markers are outside the region (extent)?

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!

1 Like

thanks! I updated my answer, now it works fine :smiley:

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

This still gives:

ERROR: MethodError: no method matching getindex(::typeof(Makie.Combined))
Stacktrace:
 [1] Tyler.Map(extent::GeometryBasics.HyperRectangle{2, Float32}, extent_crs::MapTiles.WGS84; resolution::Tuple{Int64, Int64}, figure::Figure, axis::Axis, provider::Provider, crs::MapTiles.WebMercator, max_parallel_downloads::Int64, cache_size_gb::Int64, depth::Int64, halo::Float64, scale::Float64, max_zoom::Int64)
   @ Tyler C:\Users\d34552\.julia\packages\Tyler\u3wcB\src\Tyler.jl:141
 [2] top-level scope

please, verify that you have the latest versions:

(docs) pkg> st GLMakie Tyler
Status `~/Documents/Tyler.jl/docs/Project.toml`
  [e9467ef8] GLMakie v0.10.16
  [e170d443] Tyler v0.2.0 `..`

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 ;

What version of julia are you running? History for Project.toml - efpl-columbia/PointClouds.jl · GitHub indicates that PointClouds 0.3 and later requires version julia 1.10.

Thanks - after going to v1.11 allowing for an update of all the packages and multiple reboots it now plots the test !

1 Like