Lighthouse Map

What is this?

The International Lighthouse and Lightship Weekend (ILLW) is an amateur radio activity that happens every August. Here is a map of all the lighthouses in the world.

Open Street Map data [man_made=lighthouse], extracted to a CSV and visualised using a Python Basemap showing lighthouses across the globe.

Note: The linked image is 19149 x 11585 and shows ~ 30.000 lights. It appears that some browsers are not able to display an image of this size. If you see a black screen, save the file and open it in an image editing tool.

Note: The yellow circle around each light is not representative of the pattern of the light.

Last edited: 16 June 2019

Lighthouses across the Globe by Onno VK6FLAB [Source: Open Street Map, June 2019]

Warning: Image links to 19149 x 11585 GIF (5Mb)

This map was created using the Open Street Map database. I searched for man_made=lighthouse, used overpass turbo to extract the data, then clicking on "Data", extracted the lat/lon for each result and plotted that onto a global map.

The overpass turbo script is:

/*
This query looks for nodes, ways and relations 
with the given key/value combination.
Choose your region and hit the Run button above!
*/
[out:json][timeout:1000];
// gather results
(
  // query part for: “man_made=lighthouse”
  node["man_made"="lighthouse"]({{bbox}});
  way["man_made"="lighthouse"]({{bbox}});
  relation["man_made"="lighthouse"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

If you use the bounding box as the whole world, it will timeout, so I extracted it into multiple passes, copy/pasted the data into multiple .json files and stored them together in a single directory.

I then used several bash commands to extract the lat/lon data from the json files.

The bash to extract the raw data to a csv is:

egrep -h '"(lat|lon)"' *.json | tr -d "\n :,\"" | sed 's|lat|\n|g;s|lon|,|g' | sort -u > lighthouses.csv

You can download the resulting CSV file.

Based on the example code published by Joshua Hrisko at: https://makersportal.com/blog/2018/7/20/geographic-mapping-from-a-csv-file-using-python-and-basemap, I edited it to use my data file, changed some parameters, removed labels and updated the markers.

The python is: [Source]

#!/usr/bin/python
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import csv

plt.rcParams['agg.path.chunksize'] = 10000

lats, lons = [],[]

with open('lighthouses.csv') as csvfile:
  reader = csv.DictReader(csvfile,delimiter=',')
  for data in reader:
  lats.append(float(data['LAT']))
  lons.append(float(data['LON']))

# How much to zoom from coordinates (in degrees)
zoom_scale = 0

# Setup the bounding box for the zoom and bounds of the map
bbox = [np.min(lats)-zoom_scale,np.max(lats)+zoom_scale,\
  np.min(lons)-zoom_scale,np.max(lons)+zoom_scale]

plt.figure(figsize=(12,6))
# Define the projection, scale, the corners of the map, and the resolution.
m = Basemap(projection='merc',llcrnrlat=bbox[0],urcrnrlat=bbox[1],\
    llcrnrlon=bbox[2],urcrnrlon=bbox[3],lat_ts=10,resolution='f')

# Draw coastlines and fill continents and water with color
m.drawcoastlines(linewidth=0.1)
m.fillcontinents(color='peru',lake_color='dodgerblue')

# draw parallels, meridians, and color boundaries
# m.drawparallels(np.arange(bbox[0],bbox[1],(bbox[1]-bbox[0])/5),labels=[1,0,0,0])
# m.drawmeridians(np.arange(bbox[2],bbox[3],(bbox[3]-bbox[2])/5),labels=[0,0,0,1],rotation=45)
m.drawmapboundary(fill_color='dodgerblue')

# build and plot coordinates onto map
x,y = m(lons,lats)
m.plot(x,y,'r.',markersize=0.2,mec='y')
plt.title("Lighthouses across the Globe [OSM - June 2019]")
plt.savefig('lighthouses.png', format='png', dpi=2500)
plt.show()

I then opened that in Gimp, removed the borders, added the label and uploaded it here.

Enjoy.

73, de Onno VK6FLAB