Leaflet.jl
Leaflet.jl copied to clipboard
Is it possible to plot makers and circles ?
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
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.
Thanks @rafaqz poking at this
This was a GeoInterface.jl bug: https://github.com/JuliaGeo/GeoInterface.jl/pull/84
If you checkout that branch and define a feature as I did above it should work.
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
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
Ok yes there is another bug with NamedTuple points your point is in Antarctica lol
Second bug is in GeoJSON.jl
https://github.com/JuliaGeo/GeoJSON.jl/pull/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
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
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.
It would be nice if we could specify icons like so Leaflet.Layer(geoms; icon=url) at least to points
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.