Aug 28, 2008 at 11:05 PM
Edited Sep 9, 2008 at 4:51 PM

I'm trying to project a geographic point to Albers. The result is not what I expected. Can someone look at my code and help me out?
sql code
Declare @Pnt geometry = geometry::Point( 193132.393610252,2740515.20026403, 9822);
Declare
@Pnt geography
=
geography::Point(30.017241
,95.389108, 4326);
Reproject
declare
@albers Projection
set @albers
= Projection::AlbersEqualArea(96,
37.5, 29.5, 45.5)
select @albers.ToString();
Declare @ProjPnt
geometry
= @albers.Project(@Pnt);
Select @ProjPnt.ToString();
Result
POINT (0.0092216785304098364 0.131441507182944)
I'm looking for this point:
geometry::Point( 193132.393610252,2740515.20026403)
Thanks,
Dion


Developer
Sep 9, 2008 at 4:44 PM
Edited Sep 9, 2008 at 4:45 PM

Your input point:
fi = 0.523899687814635 (30.017241 deg)
lambda = 1.66485400514046 (95.389108 deg)
Origin of cartesian coordinates:
fi0 = 0.654498469497874 (37.5 deg)
lambda0 = 1.67551608191456 (96 deg)
Standard parallels:
fi1 = 0.514872129338327 (29.5 deg)
fi2 = 0.79412480965742 (45.5 deg)
Acording to http://mathworld.wolfram.com/AlbersEqualAreaConicProjection.html the equations are:
n = (sin(fi1) + sin(fi2)) / 2 = 0.602837004628824
theta = n * (lambda  lambda0) = 0.00642749442561693
C = cos^2(fi1) + 2n * sin(fi1) = 1.3512213254179
p = sqrt(C  2n sin(fi)) / n = 1.43473357041667
p0 = sqrt(C  2n sin(fi0)) / n = 1.30326242698802
and finally the output point:
x = p * sin(theta) = 0.00922167853040983
y = p0  p * cos(theta) = 0.131441507182944
It looks like your expected coordinates are scaled by ~20.8e6.
You can use the AffineTransform class to scale the output geometry. There are examples in scripts directory.
Marko



Marko,
I will try out the transformation.
Can you explain exactly what the projection returns? How do I determine the scale?
I had a point in WGS84 Lat/Long and wanted to get it to Albers with a GCS of NAD83.
Here is the projection info from ESRI.
Projection: Albers
False_Easting: 0.000000
False_Northing: 0.000000
Central_Meridian: 96.000000
Standard_Parallel_1: 29.500000
Standard_Parallel_2: 45.500000
Latitude_Of_Origin: 37.500000
Linear Unit: Foot (0.304800)
Geographic Coordinate System: GCS_North_American_1983
Angular Unit: Degree (0.017453292519943299)
Prime Meridian: Greenwich (0.000000000000000000)
Datum: D_North_American_1983
Spheroid: GRS_1980
Semimajor Axis: 6378137.000000000000000000
Semiminor Axis: 6356752.314140356100000000
Inverse Flattening: 298.257222101000020000
Thanks for the help.
Dion


Developer
Sep 13, 2008 at 3:19 AM

Hi Dion,
The projection that is being returned is effectively a unit sphere, though certainly not a unit sphere anywhere close to the scale you would be expecting. The USGS Professional Publication 1395, "Map ProjectionsA Working Manual", by John
Snyder, is the standard reference on map projections and lists equations for both the spherical Albers and for the ellipsoidal Albers. You can download the PDF of this book here:
http://pubs.er.usgs.gov/usgspubs/pp/pp1395 If you take a look at it, our guess is that your expectations correspond more closely with the ellipsoidal Albers
map projection.
Let us know if that seems like what is going on. We are looking into how to update the codeplex sample, but may just update the projection to a more reasonable scale. We'll keep you updated either way.
Thanks,
Goldie


Sep 22, 2008 at 4:01 PM
Edited Sep 22, 2008 at 4:07 PM

Sorry for the late reply. I was dealing with Hurricane Ike over the last week.
Yes, I'm looking for the ellipsoidal Albers map projection based on GRS1980 ellipsoid, not Clarke1866.
I'll check out the book.
I appreciate the help you guys have given me. I am in the process of evaluating SqlServer 2008 for it's geospatial operations. I am hoping to remove bottlenecks in our current geospatial data processing operations which lay outside
the database using other GIS desktop software. I look forward to any updates regarding projections and linear referencing.
Thanks,
Dion

