Resources‎ > ‎Project Tutorials‎ > ‎

Create a GeoRef Projection File (*.prj file) Using uDig or QGIS

When you need to convert a GeoRef-projected shapefile to some other projection (like State Plane) for use in QGIS or any other GIS software, it may happen that the GeoRef shapefile is missing the *.prj file.  It happens more often than you might expect!  When this happens, uDig doesn't know that the shapefile is in GeoRef projection, because it needs the *.prj file to tell it so.  Without that information, uDig can't re-project the shapefile in question, because it doesn't know from what projection to re-project to your favorite projection.  We need a way to assign a GeoRef *.prj file to that shapefile.

If you examine the set of files that comprise a shapefile, you'll find that one of them has the three-letter file name extension of "prj" .  This is the shapefile projection format file, explained in some detail in this Wikipedia article.

You might think that copying the *.prj file from another GeoRef-projected shapefile and re-naming the *.prj file to match the file name of the shapefile in question would do the trick.  Unfortunately, it doesn't work.  (That would be too easy!)

This tutorial provides two methods for generating a *.prj file for a GeoRef-projected shapefile that is missing its *.prj file.  The first method involves using uDig, and the second involves using QGIS.  In both cases, you must be ABSOLUTELY, POSITIVELY sure that the shapefile with the missing *.prj file is indeed a shapefile projected to the Michigan GeoRef projection!

Method 1: Using uDig to Generate the PRJ File


This first method uses uDig to generate the missing *.prj file.  Many of the steps will be familiar to those who have used uDig to project from GeoRef to State Plane.  This method preserves the attribute table of the file with the missing projection info.

You can follow the slide show below (captions are on the slides), or follow the text version after the slide show window.  DO NOT click on the big arrow in the middle of the slide screen!

Instead, mouse-click along the bottom of the slide screen.  A set of slide control buttons will appear.  Click on the two vertical bars (the middle button) to stop the auto-play that Google insists on.  Use the arrow keys to view the slides at your own pace.

If you want to see the slide show full-screen, then click HERE.  (You'll be taken to the Picasa site where the slideshow is stored.)


  1. Start with a clean uDig project map.

  2. Bring in the shapefile with the missing PRJ file into the clean uDig map screen.  (Layer -> Add -> Files -> ...)

  3. Note that the map projection button says "Generic cartesian 2D."

  4. Right-click on the shapefile name in the Layers panel, and click on "Properties" at the bottom of the context menu that pops up.  The "Properties for <shapefile name>" dialogue box opens up.

  5. Right-click on the shapefile name in the Layers panel, and click on "Properties" at the bottom of the context menu that pops up.  The "Properties for <shapefile name>" dialogue box opens up.

  6. In this step, we insert the contents of the *.prj files supplied by the State of Michigan in their GeoRef-projected files that we can download from the Michigan Geographic Data Library (http://www.mcgi.state.mi.us/mgdl/).  The contents are the definition of Michigan GeoRef in WKT (well-known text) format, reproduced below:

  7. PROJCS["NAD_1983_Hotine_Oblique_Mercator_Azimuth_Natural_Origin",
      GEOGCS["GCS_North_American_1983",
        DATUM["D_North_American_1983",
          SPHEROID["GRS_1980", 6378137.0, 298.257222101]],
        PRIMEM["Greenwich", 0.0],
        UNIT["degree", 0.017453292519943295],
        AXIS["Longitude", EAST],
        AXIS["Latitude", NORTH]],
      PROJECTION["Hotine_Oblique_Mercator"],
      PARAMETER["longitude_of_center", -86.0],
      PARAMETER["latitude_of_center", 45.30916666666666],
      PARAMETER["azimuth", 337.25555999999995],
      PARAMETER["scale_factor", 0.9996],
      PARAMETER["false_easting", 2546731.496],
      PARAMETER["false_northing", -4354009.816],
      PARAMETER["rectified_grid_angle", 337.25555999999995],
      UNIT["m", 1.0],
      AXIS["x", EAST],
      AXIS["y", NORTH]]

  8. Copy the above (highlight it in your browser, then do CTRL-C if you're using Windows, some other appropriate method if you're using OS-X or Linux) into your clipboard. Click on the "Custom CRS" tab of the dialogue box. In the "Custom CRS" dialogue page that appears, paste (CTRL-V if you're in Windows) the Well-known Text (WKT) above into "Coordinate Reference System WKT" box.

  9. Push OK after you've pasted the WKT.  Say yes when uDig asks you if you want to change the projection of the map as well.  (Note that the projection button at the bottom of the map does not change after you clicked "yes."  It turns out that this does not matter one bit.)

  10. Now that we have established to uDig that the projection of the mystery file is GeoRef, we ask uDig to EXPORT the file as a proper set of GeoRef shape file with the appropriate *.prj and other files.

  11. In the resulting "Export to Shapefile" dialogue box, after you set the folder destination of your new file, you KEEP the projection as "NAD_1983_Hotine_Oblique_Mercator_Azimuth_Natural_Origin."  Change the name of the exported shapefile to something different than that of the shapefile with the missing PRJ file.  Then press "Finish."  uDig then creates a new shapefile with the same geometry as the original file, this new shapefile has a full-fledged *.prj file attached.

  12. You have now created a GeoRef shapefile with a valid *.prj projection definition file.  This file is now ready to be converted to State Plane Coordinates or some other projection of your choice for use in QGIS and other GIS software packages.  This method preserves the attribute table of the original file.

Method 2: Using QGIS to Generate the PRJ File (Lee Mueller Method)


Registered forester (MI) Lee Mueller ran into the "missing *.prj file" problem in his work recently.  While Lee and I were pondering, via e-mail, how to use uDig to assign a projection (see Method 1 above), he tried and succeeded using the QGIS method.  It's a pretty elegant solution to the problem, and hence we describe the method here as well! 

Its advantage is its simplicity.  The main drawback is that you will lose the attribute table of the original file.  (You will, however, inherit the attribute table of the "known" file as it applies to the area covered by the GeoRef shapefile with the missing *.prj file.  In many cases this is actually desirable --- your mileage may vary!)

This method uses QGIS to generate the *.prj file.  While QGIS cannot handle Michigan GeoRef correctly, it DOES recognize that two GeoRef files belong in the same projection, and plots them in the correct relative locations.  (It simply does not know where exactly that projection takes place on earth.)

You can follow the slide show below (captions are on the slides), or follow the text version after the slide show window.  DO NOT click on the big arrow in the middle of the slide screen!

Instead, mouse-click along the bottom of the slide screen.  A set of slide control buttons will appear. Click on the two vertical bars (the middle button) to stop the auto-play that Google insists on.  Use the arrow keys to view the slides at your own pace.

If you want to see the slide show full-screen, then click HERE.  (You'll be taken to the Picasa site where the slideshow is stored.)



The method can be summarized as follows:
  1. Fire up QGIS, and set your blank project to the Michigan GeoRef projection (EPSG:3078).  I usually turn the "on-the-fly-reprojection" feature ON.

  2. Prepare two files:
    • the shapefile which is missing the *.prj file, but which you KNOW FOR SURE is projected to Michigan GeoRef.
    • a Michigan GeoRef shapefile that has a valid *.prj file attached.  Almost any shapefile from the MI geographic data library (GDL) will do.  Choose a GDL file that covers a larger area than the shapefile that's  missing a *.prj file.

  3. Add both shapefiles to the QGIS project.  As usual, QGIS will go beserk and flip the north arrow in interesting ways.  But both shapefiles should plot correctly, relative to each other, on the map panel of QGIS.

  4. Assume that the shapefile with the missing *.prj file (call it "unknown" file) covers a smaller area than the shapefile that has a valid *.prj file ("known file").

  5. Use the unknown shapefile to clip the known shapefile, creating a new (third) shapefile with the same shape as the unknown file (but with the attributes inherited from the known shapefile).  This third file will also have a valid *.prj file (GeoRef WKT format) that it inherits from the known file.

  6. The third file has the same geographic coverage as the unknown file (other than the attribute table contents), and it has a valid *.prj file.  Now you can operate on this third file using uDig to convert its projection from GeoRef to State Plane or other projections.
Comments