Retrieving Geocoordinates From Points In Images

From reBiND Documentation
Jump to: navigation, search

Retrieving Geocoordinates From Points In Images

This manual will show how to get the geocoordinates from points in an image.


The source image we use, shows six locations in the western part of Nicaragua. Though the image is of poor quality, luckily the lines for latitude and longitude are visible in the picture.

File:JOSM Mapping 00 Original Image.png
The Source Image with six locations marked with circled dots

To start download the program JOSM from http://josm.openstreetmap.de/. JOSM is a Java based Editor for OpenStreetMap.

File:JOSM Mapping 01 Initial Window.png
The Initial Screen of JOSM

Download PicLayer Plugin

  • Start JOSM
  • Press F12 to get to the Preferences Window
  • Go to the Plugin-Tab
  • Click on Download List
  • Search for PicLayer
  • Check the checkbox for the PicLayer plugin
  • Click OK and restart JOSM
File:JOSM Mapping 02 Preferences Plugins.png
Selecting the PicLayer Plugin

Select the OpenStreetMap Image Layer

  • Go on Imagery and select OpenStreetMap (Mapnik)
  • navigate to the area of interest
File:JOSM Mapping 03 Area Of Interest.png
The area of interest is selected

Draw a reference rectangle

This step can be skipped if the image does not show the lines for latitude and longitude, like the example image above does.

  • Open a new Data Layer by pressing Ctrl + N
  • Insert a new Point by pressing Shift + D and entering its coordinates and press OK. In this example we start with 13.0 -87.0. Repeat for the other points as well: 12.0 -87,0; 12.0 -86,0 and 13.0 -86,0.
File:JOSM Mapping 04 Entering Coordinates.png
The window for entering the coordinates.
  • Switch to the drawing tool by pressing A
  • Connect the four points to a rectangle.

Loading the reference image

  • In the Menu go on PicLayer and select New picture layer from file ...
  • Select the prepared image.
  • The Picture Layer may be displayed below the OpenStreetMap Layer. If so, move it up in the Layers Box, so that the image becomes visible.
File:JOSM Mapping 06 Image Loaded.png
The image loaded as a PicLayer
  • Also make the Picture Layer the active layer, by clicking on the third button in the Layers Box Toolbar, when the Picture Layer is selected. By doing so, the tools for calibrating the picture will become visible in the toolbar at the left side.
File:JOSM Mapping 07 Image Layer Selected.png
The image layer is now the selected layer

Calibrating the reference image

  • Click on the button with the green arrow to add three reference points on the image, each on one of the confluence points (where the latitude and longitude lines cross).
  • Click on the button with the red arrow to move the reference points until they align with the corners of the rectangle.
  • If you now make the image layer semi-transparent, you can see how the image aligns with the map.
  • If you do not have the latitude and longitude lines, you should make the image layer semi transparent and try to align distinct points in the image with the map.
File:JOSM Mapping 08 Image Layer Calibrated.png
The image is now calibrated. The gray arrows of the rectangle of the data layer are now over the grid lines in the image.
File:JOSM Mapping 09 Image Layer Semi-Transparent.png
Setting the image layer as semi transparent.

Mapping the points in the image

  • Open a new data layer by pressing Ctrl + N
  • Select the drawing tool by pressing A
  • Draw points on the positions of the image from which you want to know the coordinates.
  • If there are several points, you should add a name for each point in the Properties Box on the right.
File:JOSM Mapping 10 Points Mapped And Named.png
Mapping the points. They are visible as the light small rectangles in the black dots on the image.
  • After all the points are mapped, right-click on the new data layer and select Save As ... and save it as XML file on your local file system.
File:JOSM Mapping 11 Exporting Points.png
Exporting the mapped points.
  • The file contains the coordinates of the selected points for further processing.
<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' upload='true' generator='JOSM'>
  <node id='-95' action='modify' visible='true' lat='12.881180287556537' lon='-86.11194760698338'>
    <tag k='name' v='1' />
  </node>
  <node id='-94' action='modify' visible='true' lat='12.79249813630681' lon='-86.10761639569195'>
    <tag k='name' v='2' />
  </node>
  <node id='-93' action='modify' visible='true' lat='12.403621057420668' lon='-86.22455910056097'>
    <tag k='name' v='3' />
  </node>
  <node id='-92' action='modify' visible='true' lat='12.084582576302516' lon='-86.11790302250911'>
    <tag k='name' v='6' />
  </node>
  <node id='-91' action='modify' visible='true' lat='12.20261349095152' lon='-86.46277572159048'>
    <tag k='name' v='5' />
  </node>
  <node id='-90' action='modify' visible='true' lat='12.40062989709886' lon='-86.83219726377988'>
    <tag k='name' v='4' />
  </node>
</osm>

Closing JOSM

  • Close JOSM. WARNING: When you try to close JOSM, it will ask you if you want to upload the two data layers to OpenStreetMap and selects these options for you. DO NOT UPLOAD THE DATA! Click on Exit Now.
  • JOSM will then ask if the calibration file for the image should be saved. You can do so, if you want to. It will be stored in the same directory as the image. The next time you select the image to be used by PicLayer it will detect this file and put the image in the correct position.

Useful Links