Henneke, Amanda M wrote:
Hello all-
I've been running into a problem where I'm trying to transform points into UTM
NAD83 and occasionally (does not seem to be repeatable, more random) the
TransformPoint method returns Infinity for the x and y coordinate. Just for
your info, the coordinate system I'm converting from is UTM NAD27. Anyone else
seen this? I've included my code below...am I doing something wrong or is
there some sort of an issue with the TransformPont method?
// Get the input layer's spatial reference information
OSGeo.OSR.SpatialReference sr = lyrOriginal.GetSpatialRef();
string sSpRefWKT = "";
// If this is a valid spatial reference, then export the data to a string and
return it
if (Validator.IsValid_SpatialRef(sr))
{
sr.ExportToPrettyWkt(out sSpRefWKT, 1);
}
sr.Dispose();
OSGeo.OSR.SpatialReference srOld = new OSGeo.OSR.SpatialReference(sSpRefParams);
OSGeo.OSR.SpatialReference srNew = new OSGeo.OSR.SpatialReference("");
srNew.SetUTM(11, 1);
srNew.SetWellKnownGeogCS("NAD83");
ctTransform = new OSGeo.OSR.CoordinateTransformation(srOld, srNew);
double[] dLnSegPt1 = { dX1, dY1 };
ctTransform.TransformPoint(dLnSegPt1);
Amanda,
TransformPoint() takes a three entry array, try it with:
double [] dLnSegPt1 = { dX1, dY1, 0.0 };
ctTransform.TransformPoint(dLnSegPt1);
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, [email protected]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev