# Georeference map by coordinates

In this tutorial we show you how to use coordinates to georeference a scanned topomap that has marginal information.

We’ll use a Georeferencer tool to generate a new file in GeoTIFF format, a georeferenced image.

> * [Step 1. Get coordinates](#step-1-get-coordinates)
> * [Step2. Define map projection](#step2-define-map-projection)
> * [Step 3. Add GCP points](#step-3-add-gcp-points)
> * [Step 4. Set up transformation parameters](#step-4-set-up-transformation-parameters)
> * [Step 5. Check accuracy](#step-5-check-accuracy)
> * [Step 6. Run the georeferencing](#step-6-run-the-georeferencing)

[`Download tutorial data`](https://nextgis.com/tutorials/georeference_topo.zip) (source: [U.S. Geological Survey](https://www.usgs.gov/))

<a id="topo-get-coord"></a>

## Step 1. Get coordinates

Open the map in any image viewer.

* X coordinate (longitude) is marked in the top and bottom margins;
* Y coordinate (latitude) is marked in left and right margins.

Coordinates can be marked in degrees or million feet/meters.

![image](docs_howto/source/_static/topo_corner_degrees_en.png)

To enter the coordinate in degrees, use an appropriate CRS. A popular CRS using degrees is EPSG:4326.

The map may only display the changing part of the coordiantes, so see if there are small numbers before and after the big number in the corner.
If you use million meters, you’ll at least need to add three zeroes at the end.

![image](docs_howto/source/_static/topo_corner_meters_en.png)

To use the coordinates in meters you need to know the projection of the map.

<a id="topo-projection"></a>

## Step2. Define map projection

USGS topo maps use North American Datum 1983 and Gauss-Krüger projection. EPSG codes are EPSG:269XX where XX is the zone number. In the Gauss-Krüger projection, the Earth is divided into zones by meridians every 6 degrees.

In our example the city of Madison is in UTM zone 16. The projection information can be found in the bottom left corner of the map.

![image](docs_howto/source/_static/topo_corner_srs_en.png)

This coordinate system will need to be specified in the transformation parameters and when entering points.

<a id="topo-points"></a>

## Step 3. Add GCP points

In QGIS create a new project and in the bottom right corner select the SRS of the map: `NAD83 / UTM zone 16N, EPSG:26916`

Click Layer ‣ Georeferencer ![diagonal grid](docs_howto/source/_static/mGeorefRun.png).

![image](docs_howto/source/_static/georeferencer_ui_en.png)

In the Georeferencer window open the scanned map by clicking ![mActionAddRasterLayer](docs_howto/source/_static/mActionAddRasterLayer.png).

Now you need to add ground control points that will be used to match the map with the coordinates. Control points must be as far apart as possible, because you can only guarantee georeferencing precision within the polygon this points make. So pick the grid crossings that are the closest to the corners of the map.

Zoom in to the top left corner and find the coordinate marks. In the Georeferencer toolbar select ![button_georef_add_point](docs_howto/source/_static/mActionAddGCPPoint.png) **Add GCP point** and click on the crossing. In the pop-up window enter the values of X (top) and Y (left).

Then pick the coordinate system of the zone.

![image](docs_howto/source/_static/topo_referencing_add_point_coords_en.png)

In the example, for Madison sity we set NAD83 / UTM zone 16N, EPSG:26916.

Next zoom in to the top right corner of the map, find the closest crossing and click on it. When entering the X and Y values, remember to use the full value, not just the part marked above the grid. In our example for the X coordinate you need to add 3 before the number and three zeroes afer it.

![image](docs_howto/source/_static/topo_zeroes_en.png)

You need to add 4 to 9 points depending on the transformation type.

* For maps with rectangular projections it is recommended to use transformation type Polynomial 1, it requires 4 points.
* For maps with conic projections (where you can see the meridian lines diverging) we recommend Polynomial 2, it requires 6 points.

For this map we’ll use Polynomial 1, so add 4 points + one additional point in the center. Uncheck the additional point, it will only be used to double-check the accuracy of the georeferencing.

<a id="topo-parameters"></a>

## Step 4. Set up transformation parameters

After all the points are added open, click on ![yellow gear](docs_howto/source/_static/mActionTransformSettings.png) icon in the toolbar or go to Settings ‣ Transformation settings

For topographic maps, we recommend setting the following parameters:

* Transformation type - Polynomial 1;
* Target coordinate system - as determined, EPSG:26916;
* Target raster - name of the new GeoTIFF, by default uses the name of the source image;
* Resampling method - Nearest neighbor;
* Use 0 for transparency when needed.
* Save checkpoints.

![image](docs_howto/source/_static/topo_referencing_settings_en.png)

#### NOTE
Control points can be saved to your device as a backup at any time. Click ![mActionSaveGCPpointsAs](docs_howto/source/_static/mActionSaveGCPpointsAs.png) or go to `File ‣ Save GCP points as...`. Save them to the default folder and they’ll be automatically loaded each time you run the Georeferencer.

After setting up Transformation parameters click **OK** to view transformation errors.

<a id="topo-check"></a>

## Step 5. Check accuracy

Check the Residual column. Usually the goal is to get a residual within 1 pixel.

![image](docs_howto/source/_static/topo_refrencing_correct_en.png)

Acceptable residual depends on the raster resolution. For instance, for a raster 10.000 by 10.000 pixels 10 pixel residual is fine, but for a 1.000 by 1.000 raster it’s big.

![image](docs_howto/source/_static/topo_refrencing_errors_en.png)

On this screenshot you can see long red lines and big residual in the table. This has happened because of icorrectly added numerical coordinates for the second point.

To view the coordinates of each control point on the map, go to Settings ‣ Configure Georeferencer ‣ Show coordinates.

Check the numbers you entered. After correcting the numbers, go to Transformation parameters again and click **Ok** to recalculate the residual.

If the coordinates are correct, but the residual is still big, check the transformation type.

![image](docs_howto/source/_static/topo_refrencing_errors_method_en.png)

After checking all the parameters it’s time to run the georeferencing itself.

## Step 6. Run the georeferencing

Start the georeferencing by clicking on the green arrow button ![green arrow](docs_howto/source/_static/button_start_georef.png) in the toolbar or selecting File ‣ Start georeferencing.

Georeferenced raster is added to QGIS project in GeoTIFF format. You can check it against a basemap.

Add a familiar basemap using NextGIS QuickMapServices plugin. Compare the georeferenced map with it by tweaking its opacity in the Layer properties ‣ Transparency.

![image](docs_howto/source/_static/topo_refrencing_ok_en.png)

#### SEE ALSO
[How to share your map online](https://docs.nextgis.com/docs_howto/source/quick_webmap.html)
