Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example conceals points on zoom #109

Open
jademackay opened this issue Sep 26, 2024 · 3 comments
Open

Example conceals points on zoom #109

jademackay opened this issue Sep 26, 2024 · 3 comments

Comments

@jademackay
Copy link

jademackay commented Sep 26, 2024

The "Add points, polygons and text to a map" example (here) duplicated below conceals the star point when I zoom about 10 mouse clicks. It seems to be that the point is printed over when the tiles update.

using Tyler, GLMakie
using Tyler.TileProviders
using Tyler.MapTiles
using Tyler.Extents

provider = TileProviders.Esri(:WorldImagery)

# point location to add to map
lat = 34.2013;
lon = -118.1714;
pts = Point2f(MapTiles.project((lon,lat), MapTiles.wgs84, MapTiles.web_mercator))
delta = 1
extent = Extent(X = (lon - delta/2, lon + delta/2), Y = (lat-delta/2, lat+delta/2));

m = Tyler.Map(extent; provider, figure=Figure(; size=(1000, 600)))
# wait for tiles to fully load
wait(m)

objscatter = scatter!(m.axis, pts; color = :red,
    marker = '⭐', markersize = 50)
# hide ticks, grid and lables
hidedecorations!(m.axis)
# hide frames
hidespines!(m.axis)
# Plot a plygon on the map
p1 = (lon-delta/8, lat-delta/8)
p2 = (lon-delta/8, lat+delta/8)
p3 = (lon+delta/8, lat+delta/8)
p4 = (lon+delta/8, lat-delta/8)

polyg = MapTiles.project.([p1, p2, p3, p4], Ref(MapTiles.wgs84), Ref(MapTiles.web_mercator))
polyg = Point2f.(polyg)
poly!(polyg; color = :transparent, strokecolor = :black, strokewidth = 5)

# Add text
pts2 = Point2f(MapTiles.project((lon,lat-delta/6), MapTiles.wgs84, MapTiles.web_mercator))
text!(pts2, text = "Basic Example"; fontsize = 30,
    color = :darkblue, align = (:center, :center)
    )
m

#10 mouse clicks and star disappears
@asinghvi17
Copy link
Member

@nilshg reported the same thing on Slack, if you translate!(objscatter, 0, 0, 10) it "fixes" the issue for now. You could do the same to the polygon and text plots.

@jademackay
Copy link
Author

@asinghvi17 Oh that's a good idea, thanks! I was just looking at move_in_front! in src/tile-plotting.jl.

@SimonDanisch
Copy link
Member

Maybe we should by default translate 2d maps back by 10 or so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants