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

Tamas Szekeres szekerest at gmail.com
Thu Jan 17 17:38:23 EST 2008


Mark,

This problem might be related to the following bug:
http://trac.osgeo.org/gdal/ticket/2081

You should check the correctness of the actual constant values passed
to SetLinearUnits();

The fix related to this issue is fairly new so you'd better use the
recent FWTools if possible.

I confirm that the SetLinearUnitsAndUpdateParameters is not exposed to
the SWIG API right now, so you might want to submit a ticket in case
you'd like to use that.


Best regards,

Tamas



2008/1/17, Mark Cheyne <cheynm at yahoo.com>:
> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list