[Proj] How to build the correct paramater list for pj_init()

Hamish hamish_nospam at yahoo.com
Wed Oct 31 06:01:57 EDT 2007


Richard Zinn wrote:

> Hi, Sorry if this has been addressed before, I couldn't see any way to
> search the archive.
> 
> I want to build the correct paramater list for proj based on this data:
> PROJCS["NAD_1983_UTM_Zone_12N",GEOGCS["GCS_North_American_1983",
> DATUM["D_North_American_1983",
> SPHEROID["GRS_1980",6378137.0,298.257222101]],
> PRIMEM["Greenwich",0.0],
> UNIT["Degree",0.0174532925199433]],
> 
> PROJECTION["Transverse_Mercator"],
> PARAMETER["False_Easting",500000.0],
> PARAMETER["False_Northing",0.0],
> PARAMETER["Central_Meridian",-111.0],
> PARAMETER["Scale_Factor",0.9996],
> PARAMETER["Latitude_Of_Origin",0.0],
> UNIT["Meter",1.0]]
> 
> I've read the documentation, and since I'm just a newbie to cartography
> it is all still a little unclear and I need to learn by example.
> 
> Is there any code out there (any language) I could see that takes this
> kind of input and builds out the paramaters for prj_init()?
> 
> My guess is that it is something like this:
> static char *params_in[] = {
>   "proj=tmerc",
>   "lat_0=0",
>   "lon_0=500000",
>   "units=m"
> };
> prj_init(4, params_in);
> 
> But that doesn't work :)  And I'm sure it is pretty far off.


The above is WKT "Well known text" format,
  http://en.wikipedia.org/wiki/Well-known_text

Yours looks a lot like standard UTM zone 12 North.

>From the /usr/share/proj/epsg file:
  # NAD83 / UTM zone 12N
  <26912> +proj=utm +zone=12 +ellps=GRS80 +datum=NAD83 +units=m +no_defs  <>


simple method: does it work using that EPSG code? or one of the other
UTM12N epsg codes?


using the WKT with GRASS GIS's g.proj module to make a new project location:
GRASS6.3> g.proj -c location=foo wkt=- << EOF
 PROJCS["NAD_1983_UTM_Zone_12N",GEOGCS["GCS_North_American_1983",
 DATUM["D_North_American_1983",
 SPHEROID["GRS_1980",6378137.0,298.257222101]],
 PRIMEM["Greenwich",0.0],
 UNIT["Degree",0.0174532925199433]],
 PROJECTION["Transverse_Mercator"],
 PARAMETER["False_Easting",500000.0],
 PARAMETER["False_Northing",0.0],
 PARAMETER["Central_Meridian",-111.0],
 PARAMETER["Scale_Factor",0.9996],
 PARAMETER["Latitude_Of_Origin",0.0],
 UNIT["Meter",1.0]]
EOF
Location foo created!


then in the new location we can check by outputting projection info in
WKT format:  (should be the same as the input)

GRASS6.3> g.proj -w
PROJCS["UTM Zone 12, Northern Hemisphere",
    GEOGCS["grs80",
        DATUM["North_American_Datum_1983",
            SPHEROID["Geodetic_Reference_System_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-111],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]]


and output in PROj.4 format:

GRASS6.3> g.proj -j
+proj=utm
+no_defs
+zone=12
+a=6378137
+rf=298.257222101
+towgs84=0.000,0.000,0.000
+to_meter=1


does that help?

Hamish


More information about the Proj mailing list