Hi,
I am working on an application that automatically changes the coordinate system of map layers when zoomed in beyond a certain threshold scale. I noticed that after setting the Projection on certain map layers I would get an error when trying to call GetBounidngBox on the feature layer. Specifically, this happens if I set the Projection object on a layer that's in geographical NAD83 to projected NAD83 zone 16.
So then I tried saving the extent of the layer as a Rectangle shape and then converting the rectangle to whaterver coordinate system I need and got essentially the same error. As a test, I took the coordinates of the Lower Right corner of the saved Rectangle and tried to convert just that one coordinate pair and I still get essentially the same error, stack trace below:
System.InvalidOperationException was unhandled
Message=latitude or longitude exceeded limits
Source=MapSuiteCore
StackTrace:
at ThinkGeo.MapSuite.Core.ManagedProj4Projection.ThrowException(Int32 errorNumber)
at ThinkGeo.MapSuite.Core.ManagedProj4Projection.ConvertToExternalProjectionCore(Double[] x, Double[] y)
at ThinkGeo.MapSuite.Core.Projection.ConvertToExternalProjection(Double x, Double y)
at TestProjection.Module1.Main() in C:\Users\steller\AppData\Local\Temporary Projects\TestProjection\Module1.vb:line 7
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Here is a code snippet:
Dim oProj4 As New ManagedProj4Projection(ManagedProj4Projection.GetEpsgParameters(4269), ManagedProj4Projection.GetEpsgParameters(26916))
oProj4.Open()
Dim oVertex As Vertex = oProj4.ConvertToExternalProjection(-178.215026855469, 18.9247817993164)
Any ideas?
Steve