Steps for Georeferencing Historic NC Maps

From NCMaps
Revision as of 16:26, 24 May 2010 by Ngraham (Talk | contribs)
Jump to: navigation, search

Main Page > Steps for Georeferencing Historic N.C. Maps

These instructions allow you to take a georeferenced map (see section on georeferencing historic maps) and view it as an overlay on a current map. The viewer is a GoogleMaps viewer that was specifically designed to work with websites for the Carolina Digital Library and Archives' digital collections, but could be modified to work with other websites as well. The historic map can be made transparent (to a set degree of transparency) so that one can see the current map underneath, and the user can zoom in to a level specified by the creator.

Preparing to Georeference

  1. Create a new folder
    • Navigate to the georeferenced maps folder, located at: P:\ncc_proj\NCMaps\Working Files\GIS\georeferenced maps
    • Create a new folder titled by call number.
  2. Prepare the map image
    • Find the file of the map that you want to georeference in the Digital Archive, located at: \\\ncc\NCMaps
    • Use the file name to determine which subfolder contains the map's image. File names beginning with MC will be located in the State Archives folder, and file names beginning with Cm or VC will be located in the UNC folder.
    • Copy the image from Digital Archive to the newly created folder in Working Files. Make sure from here on out you are working in the working files, not the digital archive!!
    • Open it in Adobe Photoshop and check the image size; you're aiming for an image size around 200MB (although it will probably be much larger). Crop the image if necessary.
      • If the image size is too large, change the resolution to 300 psi and/or adjust the pixel height and width. Make sure that "Constrain Proportions" is checked while you resize.
      • Have the re-sized image with the map ID as its file name (example: MC_016_1923j.TIF).
  3. Get GIS data
    • Download the GIS data for North Carolina from the Tigerline 2009 census data, located at:
    • Select the appropriate county and check the box for All lines. Download the selected files to the folder that you created.
    • Extract the GIS files using 7zip and rename the unzipped file with the county name (example: Wake).
  4. Establish a GlobalMapper workspace
    • Open GlobalMapper and go to File - Open your own data files.
    • Select your downloaded GIS data file and click through the extracted files until you find the zipped file.
    • Set your configuration settings by clicking on the Configuration icon.
      • Click on the Projection tab and make sure that the projection says Geographic (Latitude/Longitude). If you're using the wrong projection, your map won't display correctly in GoogleMaps.
      • Set the datum to WGS84.
      • Click apply.
    • Add the North Carolina railroads shapefile.
      • Go to File - Open data file and navigate to the railroad shapefile (rr.shp), located at P:\ncc_proj\NCMaps\Working Files\GIS\GIS data\railroads\rr.shp
      • Click on the Control Center icon, highlight rr.shp and click on the Options button.
      • The Vector Options window will come up, and under Classify Unclassified Line Feature As select Railroad. Railroads should now appear on your screen as a black, hatch-marked line.
    • Optional: If you want, you may change the color of secondary roads in order to see them better.
      • Click on the Configuration icon and select the Line Styles tab.
      • Select the line type you wish to change, choose a new line color, and click apply.
    • Save the GlobalMapper workspace by clicking on the Save icon, and name it with the map ID as its file name (example: MC_016_1923j.gmw).


You are now ready to work on your map!

  1. Getting started
    • Go to File - Rectify Georeference Imagery and click Ok. Navigate to the tiff file that you prepared in the Georeferenced Maps folder and click open.
    • You will now see three boxes:
      • Left: A grid of the tiff map that can be used for navigation. Clicking with the left mouse button creates a box that enables navigation around the map.
      • Middle: Here you can zoom into a specific area of the tiff map.
      • Right: Shows the GIS data laid over the tiff.
      • Using the middle and right boxes, you will be adding control points on both maps to accurately overlay the historic map on current GIS data.
    • Navigation: Holding down the left mouse button creates a box that will zoom into a specific area. Right clicks will zoom out. Moving the mouse to the edge of the box reveals a clickable arrow that you can use to slightly move over to directionally or diagonally.
  2. Making control points
    • Roads and railroads are the best points of intersection to use. Rivers, canals, and county lines are not always accurate, since they often change over time, so it's best to steer clear of using them. If you are using a more recent map, the roads may be identified by numbers instead of names. You can match the number to the name via this website:
    • The best method is to establish control points at the outer edge of the map, and then move inward. Begin by placing points along the outer edge of the map. Once the GIS data and the tiff file are aligned along the map's boundary, you can then add interior points to reduce distortion.
    • Look at the map and GIS data, and find an intersection that matches on each. To add a control point, left click with the mouse. This will add a red point. You can move it around as much as needed before adding it to the list. You will make one point in the middle box, and a corresponding point in the right box. Then, click the Add GCP to List button.
    • The control points are numbered, and listed in a box below the maps. You can jump right to a specific point by highlighting the point and double clicking on it. You can also delete the point. If you need to correct a point, select it in the box, correct the points in the middle and right boxes, and then click Update GCP Point.
    • Select points all around the edge of the map. Typically you will have somewhere between twenty and forty points. Click OK, and GlobalMapper will merge your tiff and the GIS data, giving you a base for further aligning the two to minimize distortion. Save your workspace.
    • Under Control Center, you will now see your rectified map. Highlight this map and right click on its name. Select the first option, Modify Layer Position/Projection (Re-rectify). This brings up the three boxes and allows you to zoom in and see where your map is skewed. You can delete incorrect points and begin to add interior points to improve alignment. As you add points, you can click OK to rectify the map to check its accuracy, and then return to re-rectifying. You should add only as many points as necessary to straighten the map, and on county maps points typically number into the hundreds.
  3. Finishing up
    • View your map in GoogleEarth to make sure that everything looks lined up correctly. To do so, create a .kmz file and open it up in GoogleEarth. Click on File - Export web formats - Export kml/kmz. If you find problem areas, return to re-rectifying the map. If not, you are ready to create your .png. Doublecheck the projection again - WGS84!
    • Create a png by selecting File - Export Raster and Elevation Data - Export png. Save the map as a .png file with the map ID as the file name in the folder that you created.
      • A box with specifications pops up before you hit save; save in 24-bit color (you'll probably have to change this) and with a transparent background (this is usually pre-selected).
      • When you saved your map as a png, GlobalMapper automatically created associated world files (prj and pgw). These should also be in the folder that you created.
      • Open your png in Photoshop and make sure it still looks good. Check the image size, taking note of the image height and width.
        • If you georeferenced your map using ArcGIS, look in the lower right corner of Photoshop. If your PNG image is displaying as a background layer, right-click on the layer and select Layer from Background.
          • Make sure the background pixels are transparent. You may have to crop your image if it has a black or obtrusive border. Save your adjusted image.


1. Working at the command line

   * Open the command line prompt by going to Start - Run, and then typing cmd in the box.
   * Change to the P drive by typing in P:
   * Navigate to the directory that contains your png file, and copy the file path into the cmd line.  Type cd P:\ncc_proj\NCMaps\Working Files\GIS\georeferenced maps\yourfoldername. Hit enter.
   * On a computer with php installed, create the JavaScript file that you will later use to make tiles by running the php Create Tile script in the directory.
         o Enter php C:\scripts\createTileScript.php imageFilename.png "OutputDirectory/" minZoom maxZoom
               + The imageFilename is just the name of your PNG.
               + The OutputDirectory is the folder that will be created to hold your tiles. You need to enter the entire file path, which lets the computer know where to put your new folder. The path needs to have forward slashes (unlike the back slashes we've been using thus far).  The new folder will be located on the C drive rather than the P drive, since tiling occurs more quickly from C.
               + The minZoom and maxZoom are based on the zoom levels in Google Maps, and determine at what zoom level the map is first visible and how close you can zoom in and still see it. Take a look at Google Maps to get a feeling of what the different zoom levels mean--when you're zoomed all the way out, that's a zoom level of 0. Zoomed all the way in is a zoom level of 18. For most county-level maps, your minZoom and maxZoom will be about 6 and 15. For city-level maps, they'll be more like 11 to 17. It's a little different for every map, but these will give you an idea of where to start.
               + An example of this script for the Polk County map (map ID MC_080_1923l) is: php C:\scripts\createTileScript.php MC_080_1923l.png "C:/MC_080_1923l/" 6 15, which runs the createTileScript for the georeferenced image MC_080_1923l.png, creates a directory called MC_080_1923l to hold the tiles, and sets the minimum and maximum zoom levels to 6 and 15, respectively.
         o After you hit enter, you will see some information about the tiles that will be created, including the pixel height and width of the image. These dimensions should be roughly the same as those of the PNG file when you viewed it in Photoshop. If they're wildly different (for instance, a number in the millions when your PNG was 7000x8000), this is a sign that something's amiss--check your zoom levels and your projection, and then try running the createTile script again.

2. Running the tile script

   * Open the image file (PNG) in Photoshop, if it is not still opened.
   * In Photoshop, go to File - Scripts - Browse. Navigate to the folder that holds your PNG.
   * In the drop-down menu called Files of type, change the type to Adobe JavaScript file. You should see the file that you created. (It will have a name like MC_080_1923l-ps-cut.jsx).
   * Click on the JavaScript file and then click Load.
         o The image will start blinking in an alarming way, but don't worry! This just means that it is making all of the tiles and putting them into the directory that you specified. It can take a while (upwards of an hour), especially for a bigger map.
         o When it's done, a little box will pop up that says "Finished!!!". You can close Photoshop, and you don't need to save changes.

3. Making kml files

   * At the command prompt, navigate into the directory that holds your tiles.  Type cd and the path of the folder that holds your tiles. (Example: cd C:\MC_080\1923l)
   * In this tiles directory, run the output script: php C:\scripts\maps2earth.php outputFilename "Map Title" . This will create one KML file for each tile, allowing the computer to know where to put each tile.
         * The outputFilename is the name that will be given to the big KML file for the whole map. It should be the same as the name of your PNG, but without a file extension (for instance, if your map is called MC_080_1923l.png, the outputFilename will just be MC_080_1923l).
         * The Map Title is the title that will be displayed next to the map in Google Maps.
         * An example of this for the Polk County map (map ID MC_080_1923l) would be: php C:\scripts\maps2earth.php MC_080_1923l "Polk County Soil Survey 1923", which will create kml files for each tile of the map, one big KML called MC_080_1923l.kml, and will display the map title "Polk County Soil Survey 1923."
         * For big maps, this can take a while (4 or 5 minutes), since it has to make a lot of KML files. When it's done making the files, your blinking cursor will return at the command prompt. 
   * Look in your tiles folder. There should be one kml file with the name that you specified (the rest will have numbered titles). 
         * Double-click on the kml file for the whole map. It will open your historic map as an overlay in GoogleEarth (not Google Maps). This is your chance to make sure everything is lining up correctly.
         * Find the north, south, east, and west bounding coordinates for your historic map by moving the pointer over the map. (Make sure you're recording them in decimal degrees, not degrees/minutes/seconds.) Write them down! You'll use these to help GoogleMaps know where to center your map.

4. Moving files

   * Create a folder for files that will be preserved in the digital archive, named with the map ID.  This folder should be located in \\\ncc\NCMaps\georeferenced maps.  Copy the named kml file and paste it inside this folder.  Next, revisit the folder that you created in Working Files\GIS\georeferenced maps.  Copy the png, prj, and pgw files and paste them into your digital archive folder.
   * Currently, the tiles are located on the C drive, but need to be moved to the P drive for uploading.  Right click on the folder, and choose 7zip - Add to ""  This will create a zipped copy of your tile folder, which you can then drag and drop into the P drive.  You will put the zipped folder into P:\ncc_proj\NCMaps\website\interactive\maps.

Creating the HTML Page (specific to North Carolina Maps pages)

   * Look in the GIS folder (P:\ncc_proj\NCMaps\Working Files\GIS\ncmaps-googlemaps\web); you should see a file called html_template.html. 
   * Rename the html file with the map ID (for instance, MC_080_1923l.html). 
   * Open this html file with Notepad++. Here, you need to change a few things to make the file specific to your map. 
         * In line 4, change the title to include your map's title (or an abbreviated version thereof). Include the year of publication.
         * In line 13, change the zoom levels (to the same ones you specified when you ran the createTile.php script), the path to the tiles (a relative reference, pointing to the folder within the web/maps/ folder), and bounding coordinates (which you just found in GoogleEarth). If you're confused, look at the note in line 12, and it will tell you the order in which to enter this information.
         * In line 15, enter your map's abbreviated title again.
         * In line 26, enter your map's abbreviated title at the end of the line (after "Historic Overlay Maps > ").
         * In line 44, enter the abbreviated title once again.
         * In line 80, enter the reference URL for your map. You can find the map's reference url by visiting the NC Maps website, finding the map online, and clicking on the reference url link located in the top left corner of the page.  A pop-up window will appear with the relative reference and you will use only the numbers at the end.  For example, for the reference url,336 you would want to record only the number 336.
         * In line 96, enter the reference URL again, along with the map's full title and date of publication.
         * That's it! Save the html file, and move it to P:\ncc_proj\NCMaps\website\interactive.  Let the project manager know that you have readied the tiles and html folder for uploading.
Personal tools