Django and LeafletJS - Dynamic Map Updates with AJAX Polling Requests

Описание к видео Django and LeafletJS - Dynamic Map Updates with AJAX Polling Requests

In this video, we explore using Leaflet.js with Django, and how to dynamically update positions of vehicles on a map every 5 seconds, using polling AJAX requests.

We'll see how to add markers and polylines to Leaflet FeatureGroup objects, and how to simulate vehicle movement with a Django management command.

We'll write a setInterval function in JavaScript to implement polling, and will send AJAX requests to a Django view to get updated vehicle positions.

Starter Code: https://github.com/bugbytes-io/django...

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:58 Starter code
03:21 Fetching vehicle positions in Django view
05:51 Adding Leaflet Map to Django template
10:35 Adding FeatureGroup to Leaflet map
12:10 Adding markers to Leaflet map for vehicle positions
13:18 Simulating vehicle movement with Django management command
16:09 Django view to retrieve updated vehicle positions
17:38 Fetching new positions with AJAX request
21:24 Polling server every 5 seconds with setInterval function

▶️ Full Playlist:
   • Geospatial Python  

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://www.bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/django...
🐦 Twitter:   / bugbytesio  

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Starter code: https://github.com/bugbytes-io/django...
Leaflet quick-start: https://leafletjs.com/examples/quick-...
Leaflet docs: https://leafletjs.com/reference.html
Leaflet FeatureGroup: https://leafletjs.com/reference.html#...

#python #django #gis #mapping #datascience

Комментарии

Информация по комментариям в разработке