[gdal-dev] C# OGRSpatialReference class -SetLinearUnits or SetLinearUnitsAndUpdateParameters()?

Mark Cheyne cheynm at yahoo.com
Thu Jan 17 10:14:23 EST 2008


The class documentation for the OGRSpatialReference
class
(http://www.gdal.org/ogr/classOGRSpatialReference.html)
describes two methods to set the linear units of a
projected coordinate system:

* SetLinearUnits() -
http://www.gdal.org/ogr/classOGRSpatialReference.html#2016fee7b234666c5e94d528661e6729


* SetLinearUnitsAndUpdateParameters() -
http://www.gdal.org/ogr/classOGRSpatialReference.html#daab3d6e836f93974022bd78e221c4b4


Using C# with the binaries/wrappers that come with
FWTools 2.0.3, the second method does not appear on
this class. 

* Is its absence intentional or accidental? 
* When is it appropriate to use one or the other? 

I am having trouble creating a correct NAD83HARN UTM
zone 15N PCS in units of feet. 

Look at the code below, and the Proj4 and WKT it
produces. I think the false easting is getting wonked
- note the Proj4 says it is 152,400.3 feet, but the
WKT says it is 500,000 meters. Seems like a meters
conversion is getting misapplied? Or am I using the
class incorrectly? 

OSGeo.OSR.SpatialReference sr = new
SpatialReference(""); 
sr.SetProjCS("NAD83(HARN) / UTM zone 15N"); 
sr.SetWellKnownGeogCS("EPSG:4152"); 
sr.SetUTM(15, 1); 
sr.SetLinearUnits(Constants.SRS_UL_US_FOOT,
Constants.SRS_UL_US_FOOT_CONV); 

The Proj.4 params I get: 

+proj=tmerc +lat_0=0 +lon_0=-93 +k=0.9996
+x_0=152400.3 +y_0=0 +ellps=GRS80 +units=us-ft
+no_defs 



The WKT I get: 

PROJCS["NAD83(HARN) / UTM zone 15N", 
    GEOGCS["NAD83(HARN)", 
        DATUM["NAD83_High_Accuracy_Regional_Network", 
            SPHEROID["GRS 1980",6378137,298.257222101,

                AUTHORITY["EPSG","7019"]], 
            AUTHORITY["EPSG","6152"]], 
        PRIMEM["Greenwich",0, 
            AUTHORITY["EPSG","8901"]], 
        UNIT["degree",0.01745329251994328, 
            AUTHORITY["EPSG","9122"]], 
        AUTHORITY["EPSG","4152"]], 
    PROJECTION["Transverse_Mercator"], 
    PARAMETER["latitude_of_origin",0], 
    PARAMETER["central_meridian",-93], 
    PARAMETER["scale_factor",0.9996], 
    PARAMETER["false_easting",500000], 
    PARAMETER["false_northing",0], 
    UNIT["U.S. Foot",0.3048006]] 



Mark Cheyne
(608) 332-2235 (cell)


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



More information about the gdal-dev mailing list