# drawing a line using OpenStreetMap.Mapnik (leaflet)

**URL:** <https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908>\
**Category:** phpVMS Legacy Support (v2/v5)\
**Created:** [June 3, 2023, 8:55pm UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908 "2023-06-03T20:55:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![swaluver480](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@swaluver480](https://forum.phpvms.net/u/swaluver480)\
**Post date:** [June 3, 2023, 8:55pm UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/1 "2023-06-03T20:55:58Z")

</div>

hello,&nbsp;

&nbsp;

does anyone know how to draw a line (route) or follow the plane using&nbsp;OpenStreetMap.Mapnik (leaflet).. ive searche dan dsearch but to no avail.&nbsp;

&nbsp;

thanks you&nbsp;

---

<div class="post-metadata">

**Author:** ![DisposableHero](https://forum.phpvms.net/user_avatar/forum.phpvms.net/disposablehero/32/1457_2.png) [@DisposableHero](https://forum.phpvms.net/u/DisposableHero)\
**Post date:** [June 4, 2023, 5:58am UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/2 "2023-06-04T05:58:02Z")

</div>

[https://leafletjs.com/reference.html#polyline](https://leafletjs.com/reference.html#polyline)

&nbsp;

If you have the geo locations you can draw the line as you wish by using above reference.

---

<div class="post-metadata">

**Author:** ![swaluver480](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@swaluver480](https://forum.phpvms.net/u/swaluver480)\
**Post date:** [June 4, 2023, 10:49am UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/3 "2023-06-04T10:49:19Z")

</div>

thank you!

&nbsp;

---

<div class="post-metadata">

**Author:** ![swaluver480](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@swaluver480](https://forum.phpvms.net/u/swaluver480)\
**Post date:** [June 4, 2023, 9:19pm UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/4 "2023-06-04T21:19:38Z")

</div>

> 15 hours ago, DisposableHero said:
> 
> [https://leafletjs.com/reference.html#polyline](https://leafletjs.com/reference.html#polyline)
> 
> &nbsp;
> 
> If you have the geo locations you can draw the line as you wish by using above reference.

now do you know how to draw a line following the aircraft?

---

<div class="post-metadata">

**Author:** ![ProAvia](https://forum.phpvms.net/user_avatar/forum.phpvms.net/proavia/32/135_2.png) [@ProAvia](https://forum.phpvms.net/u/ProAvia)\
**Post date:** [June 5, 2023, 2:57am UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/5 "2023-06-05T02:57:03Z")

</div>

I believe you have to access the position reports for the flight.

What ACARS program are you using and does it store position reports in the phpVMS database?

---

<div class="post-metadata">

**Author:** ![swaluver480](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@swaluver480](https://forum.phpvms.net/u/swaluver480)\
**Post date:** [June 5, 2023, 10:41am UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/6 "2023-06-05T10:41:55Z")

</div>

> 7 hours ago, ProAvia said:
> 
> I believe you have to access the position reports for the flight.
> 
> What ACARS program are you using and does it store position reports in the phpVMS database?

Smartcars, definitely looks like it does

&nbsp;

phpmyadmin \_\>acarsdata feed

---

<div class="post-metadata">

**Author:** ![ProAvia](https://forum.phpvms.net/user_avatar/forum.phpvms.net/proavia/32/135_2.png) [@ProAvia](https://forum.phpvms.net/u/ProAvia)\
**Post date:** [June 5, 2023, 4:32pm UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/7 "2023-06-05T16:32:15Z")

</div>

In that case, you will have to write some code to retrieve that data and display it on the map and have it update from time to time.

&nbsp;

I don’t recall seeing any module that displays that live - as the flight is progressing. There was at least one payware ACARS client - no longer available - that provided a flown flight map file that showed the planned route as well as the actual flight path of the aircraft… but it only provided the display after the PIREP was filed.

---

<div class="post-metadata">

**Author:** ![DisposableHero](https://forum.phpvms.net/user_avatar/forum.phpvms.net/disposablehero/32/1457_2.png) [@DisposableHero](https://forum.phpvms.net/u/DisposableHero)\
**Post date:** [June 5, 2023, 7:34pm UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/8 "2023-06-05T19:34:00Z")

</div>

> 22 hours ago, swaluver480 said:
> 
> now do you know how to draw a line following the aircraft?

&nbsp;

Yes I know how to do that, if you can develop it on your own logic is simple

&nbsp;

\* Get your live flights

\* Read their live position reports and build arrays for each flight

\* For each live flight you have, use it’s last position as the last geo location, then draw lines between each geo location starting from the departure airport, preferably with a greenish color (completed part)

\* Then draw a geodesic line (great circle line) from the last position to arrival airport, preferably with a redish color (not completed part)

\* Also if you have enough data, you can draw a line for the planned route, preferably with a blueish color

\* Optimize your leaflet map, add some layers (like enabling / disabling the route or the plan)

\* Automate the updates if you wish to (like an auto refresh of the map data, re-reading everything an processing everything again, preferably find a nice way to do this to reduce server load)

\* Test your map while some of your pilots are flying

&nbsp;

All this can happen, depending on your skills. Nothing impossible, but not easy too.

&nbsp;

This also depends on your acars software, if it is not sending back live position data during flights then do not start even thinking about a live map, consider building a pirep map with the above logic (which will be a one time process as the flight will already be landed and finished)

&nbsp;

Good luck

&nbsp;

Important Note: Me knowing how to do it does not mean that I can do it for you, or willing to do it for you (or somebody else). I just answered your main questions with positive replies, rest is up to you (or your web developer).

---

<div class="post-metadata">

**Author:** ![swaluver480](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/s/e480ec/32.png) [@swaluver480](https://forum.phpvms.net/u/swaluver480)\
**Post date:** [June 5, 2023, 9:33pm UTC](https://forum.phpvms.net/t/drawing-a-line-using-openstreetmap-mapnik-leaflet/13908/9 "2023-06-05T21:33:22Z")

</div>

> 1 hour ago, DisposableHero said:
> 
> &nbsp;
> 
> Yes I know how to do that, if you can develop it on your own logic is simple
> 
> &nbsp;
> 
> \* Get your live flights
> 
> \* Read their live position reports and build arrays for each flight
> 
> \* For each live flight you have, use it’s last position as the last geo location, then draw lines between each geo location starting from the departure airport, preferably with a greenish color (completed part)
> 
> \* Then draw a geodesic line (great circle line) from the last position to arrival airport, preferably with a redish color (not completed part)
> 
> \* Also if you have enough data, you can draw a line for the planned route, preferably with a blueish color
> 
> \* Optimize your leaflet map, add some layers (like enabling / disabling the route or the plan)
> 
> \* Automate the updates if you wish to (like an auto refresh of the map data, re-reading everything an processing everything again, preferably find a nice way to do this to reduce server load)
> 
> \* Test your map while some of your pilots are flying
> 
> &nbsp;
> 
> All this can happen, depending on your skills. Nothing impossible, but not easy too.
> 
> &nbsp;
> 
> This also depends on your acars software, if it is not sending back live position data during flights then do not start even thinking about a live map, consider building a pirep map with the above logic (which will be a one time process as the flight will already be landed and finished)
> 
> &nbsp;
> 
> Good luck
> 
> &nbsp;
> 
> Important Note: Me knowing how to do it does not mean that I can do it for you, or willing to do it for you (or somebody else). I just answered your main questions with positive replies, rest is up to you (or your web developer).

just wanted info on how to do it. ill figure the rest out&nbsp;

&nbsp;

thank you so much!
