Use ArcObjects to change units from meters to feet in UTM_Zone_13N

2252
4
08-08-2013 07:53 AM
PaulDavidson1
Regular Contributor
I inhereted an ArcObject system in 9.3 that reads in a csv file of XY locations and converts it into our state plane coord system.
Recently the csv source went from NAD_27 to NAD_1983 w/ UTM_ZONE13N.

I am close to getting this to work but my problem (I think) is that the csv file has XY coordinates in feet (US I believe) and the standard UTM_ZONE_13N coord system is expressed in meters. Yes, this is odd but it is what it is.
I have verified that most of code is correct by using ArcGIS to convert my raw data back to meters, hacking the code to read that file, etc...

In ArcGIS I can modify the coord system to be in feet and project the points correctly but in the ArcObject code I cannot figure out anyway to do this. Is this via ScaleFactor ? Resolution ?

Here's what I think is the pertinent code:
Dim spatialReferenceFactory As ISpatialReferenceFactory = New SpatialReferenceEnvironmentClass()
Dim projectedCS As IProjectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem(CInt(Fix(esriSRProjCSType.esriSRProjCS_NAD1983UTM_13N)))

Dim tempSR As ISpatialReference = TryCast(projectedCS, ISpatialReference)
tempSR.SetDomain(-16800800, 2955095154692.94, -32802000, 2955095154692.94)
tempSR.SetMDomain(-100000, 2955095154692.94)
tempSR.SetZDomain(-100000, 2955095154692.94)

Dim spatialRefResolution As ISpatialReferenceResolution = TryCast(tempSR, ISpatialReferenceResolution)
spatialRefResolution.XYResolution(False) = 0.000328083333333
Dim spatialRefTolerance As ISpatialReferenceTolerance = TryCast(spatialRefResolution, ISpatialReferenceTolerance)
spatialRefTolerance.XYTolerance = 0.000328083333333

toFeatureWorkspace.CreateFeatureDataset(datasetFullName, tempSR)

Is there a way to set the projectedCS to be in Foot_US ?

I also don't see why tempSR is being used as opposed to projectedCS.SetDomain, etc...
Looks like all tempSR does is take up extra memory. Maybe I'm missing something.

This is my first venture in ArcObjects so it's a lot to take in.
I think the code is probably very complicated but it is what it is for now.
Thanks

And is this the appropriate forum for this post or should this be in a coding forum ?  Which one, ArcObjects SDK?
0 Kudos
4 Replies
MelitaKennedy
Esri Notable Contributor
In 9.3, we didn't have a NAD 1983 UTM zone 13N that uses US survey feet. We have added one in 10.1 (WKID = 4433) but you would need to create a custom definition. You could create a .prj file that contains the new definition and create the coordinate system from that. You could also convert your input data from feet to meters and use the standard UTM zone.

Melita
0 Kudos
PaulDavidson1
Regular Contributor
In 9.3, we didn't have a NAD 1983 UTM zone 13N that uses US survey feet. We have added one in 10.1 (WKID = 4433) but you would need to create a custom definition. You could create a .prj file that contains the new definition and create the coordinate system from that. You could also convert your input data from feet to meters and use the standard UTM zone.
Melita


Pretty much what I thought.  Was hoping there was a way to tell a projection to just use a different unit but I couldn't find any method or property that allowed it.  So then I thought a custom prj would do it.  At least I was on the right track.

One question, I did write a python script that would transfer the input data but it looks like I can't just convert from feet to meters via linear transformation (of 1m=3.20884 ft) .  I suspect it would have to be modified via a projection.  The linear xform has the points shifted a bit...  Sound right ?
0 Kudos
MelitaKennedy
Esri Notable Contributor
Is there a transcription error in the conversion value?? It should be 3.28083333333333. In meters, you have values at 5 and 6 places even before crossing into decimals, so you need to use a conversion value that matches the desired precision, and probably has at least 1 or 2 extra digits.

IProjectedCoordinateSystem2 has PutLinearAndAngularUnits method. That might work.

Melita
0 Kudos
PaulDavidson1
Regular Contributor
Is there a transcription error in the conversion value?? It should be 3.28083333333333. In meters, you have values at 5 and 6 places even before crossing into decimals, so you need to use a conversion value that matches the desired precision, and probably has at least 1 or 2 extra digits.

IProjectedCoordinateSystem2 has PutLinearAndAngularUnits method. That might work.

Melita


I feel a bit stupid.  I suspect you're correct.  I'll also look into the IProjectedCoordinateSystem2 method.
Using the increased precision puts my numbers almost spot on.  It's down to about the 3rd or lower decimal point.
Plenty accurate for what we're doing.
Many thanks.
0 Kudos