Project to UTM - long0 values

Sep 23, 2009 at 5:14 PM

Hi,

I want to convert coordinates to UTM zone 30, but I don't know the value of lon0 parameter. Does exist any function or table to calculate this lon0 from UTM zone?

This is my code:

// CREATE POINT

SqlGeographyBuilder geogBuilder = new SqlGeographyBuilder();geogBuilder.SetSrid(4326);
geogBuilder.BeginGeography(OpenGisGeographyType.Point);
geogBuilder.BeginFigure(40, -3);
geogBuilder.EndFigure();
geogBuilder.EndGeography();

// CREATE PROJECTION SINK

SqlGeometryBuilder buildertest = new SqlGeometryBuilder();

double lon0 = -3;

Projector p = new Projector(SqlProjection.TranverseMercator(lon0), buildertest);

// PROJECT

geogBuilder.ConstructedGeography.Populate(p);
Console.WriteLine(buildertest.ConstructedGeometry.STSrid.ToString() + "\t" + buildertest.ConstructedGeometry.ToString());

Developer
Oct 15, 2009 at 8:22 PM
Edited Oct 15, 2009 at 8:23 PM

It is as simple as:

lon0 = zone * 6 - 183

The UTM system divides the surface of the Earth between 80° S latitude and 84° N latitude into 60 zones, each 6° of longitude in width and centered over a meridian of longitude. Zones are numbered from 1 to 60. Zone 1 is bounded by longitude 180° to 174° W and is centered on the 177th West meridian. Zone numbering increases in an easterly direction.

Jun 24, 2010 at 3:43 PM

Hi,

I have a similar issue. I have a series of WGS84 geography types that I would like to dynamically project to an appropriate UTM Zone for calculations.

CREATE TABLE [GeoTest](
	[ID] INT IDENTITY(1,1) PRIMARY KEY CLUSTERED,
	[geog] GEOGRAPHY NULL,
	CONSTRAINT [enforce_srid] CHECK ([geog].STSrid = 4326),
	CONSTRAINT [enforce_spatial_type] CHECK ([geog].STGeometryType() = 'Polygon'))

-- Insert some Geographies
INSERT INTO [GeoTest] ([geog]) VALUES (geography::STPolyFromText('POLYGON((-94.8 31.5, -94.5 31.5, -94.5 31.8, -94.8 31.8, -94.8 31.5))', 4326))
INSERT INTO [GeoTest] ([geog]) VALUES (geography::STPolyFromText('POLYGON((-95.3 32.5, -95.3 32, -94.6 32, -94.6 32.5, -95.3 32.5))', 4326))
INSERT INTO [GeoTest] ([geog]) VALUES (geography::STPolyFromText('POLYGON((-94.3 32.5, -94.3 32, -93.6 32, -93.6 32.5, -94.3 32.5))', 4326))

-- Select area and length measurements for comparison
SELECT [ID], [geog].STArea() AS [GeogArea], [geog].STLength() AS [GeogLength], AffineTransform::Scale(6378137, 6378137).Apply(Projection::TranverseMercator(CAST(FLOOR((geometry::STGeomFromWKB([geog].STAsBinary(),[geog].STSrid).STCentroid().STX + 180)/6+1) AS INT)*6-183).Project([geog])).STArea() AS [UTMArea], AffineTransform::Scale(6378137,6378137).Apply(Projection::TranverseMercator(CAST(FLOOR((geometry::STGeomFromWKB([geog].STAsBinary(),[geog].STSrid).STCentroid().STX + 180)/6+1) AS INT)*6-183).Project([geog])).STLength() AS [UTMLength]
FROM [GeoTest]

 

I'm worried that I might be using incorrect parameters for AffineTransform::Scale(). My first thought was that one of the Scale inputs should have the "flattened" radius of the WGS84 spheroid (semiminor axis: 6356752.314). I experiemtned with this and the output UTMArea and UTMLength look correct, but upon comparing the area and length measurements against the output from the projection process in ArcMap, I see different measurement results for the UTM measurements. I'm sure that I'm doing something wrong here.

Thoughts?

 

Feb 29, 2012 at 1:59 AM

Don't know if this issue is still valid... I'm simply posting for the sake of future reference. I had some WSG 1984 geographies which needed to be projected into UTM on run-time using TranverseMercator. So I used this SqlSpatialTools library like adair but the numbers did not exactly matched after compering to ESRI ArcGIS outputs. So I found this page (http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html) and based on the javascript implementation, coded a C# class within the SQLSpatialTools framework to take care of it. Now, does anyone knows how I can submit this new class (patch files) to the project admins?