Bar plots on Google Earth Pro

Table of Content
Creating Bar plots kml files for Google Earth Pro using Python googleearthplot referring to this site.


Suppose pandas is installed. Install simplekml and googleearthplot.

pip install simplekml
pip install googleearthplot

googleearthplot is a Python2 code and some modification is required in Python3 because of an error associated with print statement. First find the location of installed googleearthplot as follows:

pip show googleearthplot

Edit to modify the lines of print statement by converting print **** to print(****) using parentheses.


Open a Jupyter Notebook and import packages. Referring to the original site, some examples are shown. Double cricking on created kml file, a plot should be presented on Google Earth Pro.

from googleearthplot import googleearthplot as gep
import pandas as pd

Point plot

The following is a sample plot for a point plot.

lon=139.0 #degree
lat=35.5 #degree

Bar plot

The following is a sample plot for bar plot.

#A bar plot 
lat=35.5 #degree
lon=139.5 #degree
num=100 #bar height size
size=1  #meter

You can create multiple bar plots using for loop.

Read data from file and create bar plot

Suppose a text data file of sample3.txt. Its contents are three columns of longitude, latitude, and height:

  139.662750    35.477141   166.771019
  139.663961    35.477226   171.858589
  139.665148    35.477312   169.775301
  139.666306    35.477394   160.395112

Read this file and create a pandas DataFrame.

fpath = "sample3.txt"
names = ["lon", "lat", "height"]
df = pd.read_csv(fpath, sep='\s+', header=None, names=names)
### Exclude lines of height==0
lon_p = df[df['height'] != 0.0]['lon'].values
lat_p = df[df['height'] != 0.0]['lat'].values
height_p = df[df['height'] != 0.0]['height'].values

gep3 = gep.googleearthplot()
for (lon, lat, height) in zip(lon_p, lat_p, height_p):
    gep3.PlotBarChart(lat, lon, height, size, name, color)

There is also a method to directly convert csv data file to bar plots using PlotBarChartsFromCSV method. For more information, see the original site.


  • PyPi googleearthplot url
  • GitHub AtsushiSakai/googleearthplot url

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.