Commons:Geocoding/Overlay

Diese Seite auf deutsch: Commons:Geocoding/Overlay-de

Commons map overlays
Commons map overlays

This help page explains how to map old aerial photos, city plans, and regional maps onto current satellite imagery in Google Earth and make these Overlays available to other users. This allows users to visualize progress in time such as city growth, or damage caused by wars and natural disasters.

Usage

edit

A collection of maps prepared as overlays is available here:

All maps in this category contain a box on their image description page with a link labeled Open this map in Google Earth. Clicking this link should launch Google Earth (if installed). After some load time, the maps will appear in their approximate geographic position. Structures and objects can then be compared to the Google Earth satellite imagery using the Google Earth transparency sliding control. The overlay can be toggled on or off using the checkbox next to the map in the Google Earth side bar. Concerning the agreement with today's satellite photographs, please note that historic maps which may be over a hundred years old were not created using the exact surveying techniques available today. Furthermore, Google Earth limits the possible overlay adjustments for position, rotation, and scaling, so the overlay quality may vary considerably.

How to create a map-overlay

edit

Create kml in Google Earth

edit
  1. Find a suitable map image on Commons, or upload it to Commons yourself.
  2. Launch Google Earth and zoom into the area where the map-overlay will be positioned
  3. Open the Add menu and select Image Overlay...'
    A detailed tutorial on image overlays can be found here
  4. Assign an appropriate name. Under Link enter the upload path of the image, for example http://upload.wikimedia.org/wikipedia/commons/2/2a/Erfurt-1650-Merian.jpg and wait till the image is loaded. This way we are accessing the full resolution image, even if it gets scaled down for display purposes in Google Earth.
  5. Now adjust the image to the map as well as possible by dragging and rotating it with the mouse. Hint: Adjust the rotation by matching a river or road first, then by using points on opposite corners adjust scale and position. Then double-check the rotation, and repeat if necessary... Note: This part is a little tricky and might take up to 15 minutes.
  6. If you are satisfied with your overlay, proceed to the next steps. Please note that due to mismatching map projections or inaccuracies of the overlay image, you might have to abort at this step.
  7. Edit the image description page on Commons and insert the {{Overlay}} template. The template creates a new infobox which contains a source link. Follow it and choose edit. For cosmetic purposes enter the following tags: in the first line <syntaxhighlight lang="xml"> and the last line </syntaxhighlight> of the edit box.
  8. Now insert the KML-source from Google Earth between the tags: select the overlay image in the Google Earth side bar and press Ctrl+C, switch back to the webbrowser and paste the KML-source between the two tags by pressing Ctrl+V, then save. Should this method not work in your OS, then right click on the overlay in Google Earth, select "Save as KML", and open the file in a text editor to do the copy/paste routine.
  9. The final step would be testing the overlay on commons (remove the maps from your Google Earth beforehand!)

Create kml in MATLAB or Octave

edit

Here is example of how kml overlay was created for this file.

  1. Download full resolution file and open it in image display program that shows x, y coordinates of the cursor, like GIMP or xnView.
  2. Record map x, y coordinates of several cities. In this case I picked: Berlin, Paris, Munich, and Cologne. Three or more cities should be used
  3. Record latitude and longitude coordinates of those cities. I used coordinates stored in Wikipedia articles. The decimal notation can be accessed after clicking on the geohack link in the top right corner of each article.
  4. Record width and height of the image as well as url of full resolution image
  5. In MATLAB or Octave cut and paste the code below and change the variables in the "Input" section. Than run the code.
%% Inputs
X   = [7772; 330; 6679; 3633];         % x map coordinate of 4 cities on the map
Y   = [553; 4122; 5248; 2194];         % y map coordinate of 4 cities on the map
lat = [52.516; 48.857; 48.133; 50.95]; % latitude of 4 cities on the map
lon = [13.383; 2.351; 11.567; 6.97];   % longitude of 4 cities on the map
nx   = 8150;                           % image width
ny   = 6978;                           % image height
url = 'http://upload.wikimedia.org/wikipedia/commons/b/bf/F._M%C3%BCllhaupt%27s_Militarische_%26_Verkehrs-Karte_der_Deutsch-Franz%C3%B6sischen_Grenze...jpg';
name = 'F. M%C3%BCllhaupt%27s Militarische %26 Verkehrs-Karte der Deutsch-Franz%C3%B6sischen Grenze..';

%% Calculations
M = [X, Y, ones(length(X),1)] \ [lon, lat]; % Calculate transformation matrix
corners = [ 1, ny, 1; nx, ny, 1; nx, 1, 1; 1, 1, 1] * M; % Calculate location of 4 corners

%% Write KML
fprintf('<source lang="xml">\n');
fprintf('<?xml version="1.0" encoding="UTF-8"?>\n');
fprintf('<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">\n');
fprintf('  <GroundOverlay>\n');
fprintf('    <name>%s</name>\n', name);
fprintf('    <Icon>\n');
fprintf('      <href>%s</href>\n', url);
fprintf('    </Icon>\n');
fprintf('    <gx:LatLonQuad>\n');
fprintf('      <coordinates>\n');
fprintf('        %f,%f %f,%f %f,%f %f,%f\n', ...
  corners(1,1), corners(1,2), corners(2,1), corners(2,2), ...
  corners(3,1), corners(3,2), corners(4,1), corners(4,2) ...
  );
fprintf('      </coordinates>\n');
fprintf('    </gx:LatLonQuad>\n');
fprintf('  </GroundOverlay>\n');
fprintf('</kml>\n');
fprintf('</ source>\n');
  1. Cut and paste the resulting text into "/overlay.kml' subpage of the image.

Similar codes can be probably written i other programing languages.

Further remarks

edit
  • The reasons for using Google Earth as a tool are its performance, ease of use, free (as in beer) availability across several platforms, and use of the free and standardized data format KML.