How to create a Wind Rose in KML format (google earth) using Python

294 views Asked by At

I need to create a Wind Rose KML file to be opened in google earth with as (similar to) the following pictures.

Wind rose in google earth 1 Wind rose in google earth 1 enter image description here

I can create wind roses using windrose python module, like this one: wind rose in python

And I know how to create KML points and lines in python using simplekml module like this one: enter image description here

Does anyone know any package capable of doing that? or any idea of how to do it?

2

There are 2 answers

0
Regulus On

If you use matplotlib when draw windrose, try to save the fig with following opthons.

plt.axis('off')
plt.savefig('windrose.png', bbox_inches='tight', pad_inches=0, transparent=True)

After you got the image file, generate ground overlay code in kml.

import simplekml

kml = simplekml.Kml(open=1)

doc = kml.newdocument(name='sample', open=1, visibility=0)

ground = doc.newgroundoverlay(name='windrose example')
ground.icon.href = 'windrose.png'
ground.altitudemode = simplekml.AltitudeMode.absolute
ground.altitude = 500.0
ground.latlonbox.north = 38.031368255615234
ground.latlonbox.south = 37.11344909667969
ground.latlonbox.east =  141.5791015625
ground.latlonbox.west =  140.4208984375
ground.visibility = 1

kml.save('sample.kml')

Each values are need to adjust.

Please refer following, if you'd like to know more about ground overlay.

https://developers.google.com/kml/documentation/altitudemode#absolute

0
stanislav888 On
  1. Open Google Earth.
  2. Draw a static picture\chart like wanted one over a map.
  3. Save it into a KML file.
  4. Open with any text editor.

It must show you an example which lead you to generate a valid KML with your data.