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

Is it possible to plot makers and circles ? #6

Open
alex-s-gardner opened this issue Dec 20, 2022 · 11 comments
Open

Is it possible to plot makers and circles ? #6

alex-s-gardner opened this issue Dec 20, 2022 · 11 comments

Comments

@alex-s-gardner
Copy link

So glad to see this library!!! Thanks for all of your efforts.

Is it possible to plot makers and circles [as shown for the JaveScript](library https://leafletjs.com/examples/quick-start/)?

My attempt was:

using Leaflet, Blink, GADM, GeoInterface
layers = Leaflet.Layer.([(X=73.5, Y = 70, geometry = "Point")]; color=:red);
provider = Leaflet.Esri(:imagery)
m = Leaflet.Map(; layers, provider, zoom=9, height=1000, center=[70, -73.5]);
w = Blink.Window()
body!(w, m)

but no marker is visible

@rafaqz
Copy link
Member

rafaqz commented Dec 20, 2022

Your syntax is not quite right but ther right syntax is broken too so I gues syou tried it
This should work, but it doesn't - somehow the geometry in the GeoJSON is null even though GeoInterface.geometry(feature) gives us the right result. I will have to look into it a little.

feature = (; geometry=(X=73.5, Y = 70))
layers = Leaflet.Layer(feature; color=:red)

Most likely this is a GeoJSON.jl bug.

@alex-s-gardner
Copy link
Author

Thanks @rafaqz poking at this

@rafaqz
Copy link
Member

rafaqz commented Dec 21, 2022

This was a GeoInterface.jl bug: JuliaGeo/GeoInterface.jl#84

If you checkout that branch and define a feature as I did above it should work.

@alex-s-gardner
Copy link
Author

For me it seems the issue persists. Maybe I'm missing something. Executing the following produces an interactive map without any markers:

# ]add GeoInterface#fix_base_types
using Leaflet, Blink, GADM, GeoInterface

begin
    feature = (; geometry=(Y=70, X=-73.5))
    layers = Leaflet.Layer(feature; color=:red)
    provider = Leaflet.Esri(:imagery)
    m = Leaflet.Map(; layers, provider, zoom=9, height=1000, center=[70, -73.5]);
    w = Blink.Window()
    body!(w, m)
end 

@rafaqz
Copy link
Member

rafaqz commented Dec 22, 2022

Did you check out the PR branch of GeoInterface.jl?

Also your zoom area is wrong.

It's working here, if you are on that PR I will see if I missed something somewhere

@rafaqz
Copy link
Member

rafaqz commented Dec 22, 2022

Ok yes there is another bug with NamedTuple points your point is in Antarctica lol

@rafaqz
Copy link
Member

rafaqz commented Dec 22, 2022

Second bug is in GeoJSON.jl

JuliaGeo/GeoJSON.jl#57

After that you example is working for me

Edit: I'm thinking we should make that center keyword accept a proper GeoInterace.jl point so you can specify (Y=70, X=-73.5) for clarity

@alex-s-gardner
Copy link
Author

I agree that the center keyword should GeoInterace.jl or at a minimum be x, y order... I hate the lat, lon order legacy and feel the Julia Geo should take the opportunity to retire the old convention and stick with x, y order when needed

@rafaqz
Copy link
Member

rafaqz commented Dec 27, 2022

Sure, I agree. Note that that keyword is just a direct translation to the javascript, it's not something anyone really made a decision about.

@ctlbau
Copy link

ctlbau commented Mar 8, 2023

It would be nice if we could specify icons like so Leaflet.Layer(geoms; icon=url) at least to points

@rafaqz
Copy link
Member

rafaqz commented Mar 8, 2023

Absolutely! But you should make another issue for that, as when I close this as completed whenever we can finally merge the GeoJSON.jl PR, your idea will be lost.

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