Leaflet maps in SvelteKit like it's 2023 (HowTo)

Ғылым және технология

Join an AI-generated, alien-fingered programmer with the weirdest glasses you have ever seen on her epic Midjourney to impress her clients & boss by implementing Leaflet maps (and any other ugly-API JavaScript library, really) the "Svelte" way with renderless components!
Who told you coding videos can't be fun?
Repository: github.com/ShipBit/sveltekit-...
Tech used: www.shipbit.de/blog/leaflet-s...
00:00 - Intro
01:04 - Context API vs. State
01:51 - Chop, Chop! Let's implement...
02:05 - The Map
04:11 - Window is not defined
04:42 - Markers
05:49 - Bonus: Custom marker images
06:25 - Popups
07:26 - The fruit we harvest
#shipbit
Do you have a great idea for a video and need some help with the production? Then contact us and we’ll see what we can do!
Go and play "Dave the Diver". It's amazing!
- - -
Twitter/X: @shipbitagency, @shopstaetter
Web: shipbit.de/
- - -

Пікірлер: 19

  • @nemeziz_prime
    @nemeziz_prime12 күн бұрын

    Damn that's an amazing tutorial 🔥 would love to see a complete Leaflet + Sveltekit project tutorial

  • @riigel
    @riigel10 ай бұрын

    what the heck, very well made video 😅

  • @MrEQuecky
    @MrEQuecky11 ай бұрын

    Off to play Dave the Diver^^

  • @matanon8454
    @matanon845411 ай бұрын

    Awesome video! ❤

  • @SirDerRosen
    @SirDerRosen4 ай бұрын

    Thank you for the tutorial, was helpful and funny to watch, Grüße aus Deutschland 😁

  • @shaikhspare7019
    @shaikhspare70199 ай бұрын

    Feedback was the fun part, lol😍

  • @daleryanaldover6545
    @daleryanaldover654510 ай бұрын

    So this is what generative content looks like when done right?! Some of the part in making the video I assume.

  • @ShipBit

    @ShipBit

    10 ай бұрын

    Thanks and yes: The voices are generated with #11labs, the rest is all manual work. We really wanted to try out how much "personality" you can generate with these AI voices.

  • @wippy4260
    @wippy426010 ай бұрын

    Nice video! I'm new to Svelte and i'm still learning; in this case how can i add leaflet plugin (like leaflet marker cluster) to this project? I'm trying but with no success.

  • @ShipBit

    @ShipBit

    9 ай бұрын

    I've actually used the leaflet.markercluster plugin in the past with Svelte and it works fine. The basic structure is just like as described in the video. In your new MarkerCluster component, you import the plugin like this: using import 'leaflet.markercluster'; and then you create a group and add your markers to it: markerClusterGroup = L.markerClusterGroup(); markerClusterGroup.addLayer(markers).addTo(map); Hold a reference to the markerClusterGroup variable and then you can reset and control it anywhere in your component, even in reactive expressions.

  • @shellwhale8994
    @shellwhale89945 ай бұрын

    Hi, nice video! What's the map at 0:54 ? I like the color scheme

  • @shackyalla

    @shackyalla

    4 ай бұрын

    It’s a b&w map and some video editing / color grading. sorry…

  • @spicymustard9066
    @spicymustard90669 ай бұрын

    Idk if anyone has tried this but I've run into a pretty big issue - in the child Marker class, when calling getContext('map') to get the map object that should be set by the parent Leaflet component, it is always undefined. I guess the onMount() of the parent Leaflet component takes some amount of time to execute before the map object is actually set & in this time the child has already tried calling for that context value. Luckily for my use case, markers will come from API calls so the map will already be rendered and then when the children are added the map object will exist, but if you have marker objects up-front at "compile" time for svelte, idk how you're getting them to render properly.

  • @ShipBit

    @ShipBit

    9 ай бұрын

    Do you have a repository to reproduce this? Afaik the "plain" code inside of a component should execute before the onMount function is called. That's why you have to call setContext on the top-level of a component. I'd be happy to take a look in a repro-repo.

  • @davenash1547

    @davenash1547

    6 ай бұрын

    I had this same trouble, until I found that I hadn't properly closed my Leaflet element (with after adding the slotted elements). @ShipBit, great video. Thanks!

  • @thedelanyo
    @thedelanyo10 ай бұрын

    😂 AI also loving Svelte

  • @kinos.studio
    @kinos.studio9 ай бұрын

    I think you have great potential as a teacher and there is still space in the svelte creators area

  • @ShipBit

    @ShipBit

    9 ай бұрын

    Thank you! We'd love to create more content in the future.

Келесі