Hi,
I am currently evaluating Map Suite Desktop. We are currently using shape files and over the years have developed several custom projected coordinate systems for our clients. We need to be able to support these moving forward, so I've been trying to figure out how to do this if we move to Map Suite and SQL Server 2008.
Let me use one of these as an example, called Lambert Conformal Conic Montana Feet. I have figured out how to make this work with our shape files in this coordinate system. I simply translated the string in the prj file to an equivalant string in Proj4 format.
prj file
PROJCS["Custom",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983", SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",1968503.937007874],PARAMETER["False_Northing",0.0], PARAMETER["Central_Meridian",-109.5],PARAMETER["Standard_Parallel_1",45.0],PARAMETER["Standard_Parallel_2",49.0], PARAMETER["Latitude_Of_Origin",44.25],UNIT["Foot",0.3048]]
Proj4
+proj=lcc +lat_1=45 +lat_2=49 +lat_0=44.25 +lon_0=-109.5 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs
Using the Proj4 string I can successfully create a ManagedProj4Projection object and my custom coordinate system shape file layers line up just fine.
The question then becomes, How do I make this work with SQL Server 2008? I used a utility to load one of the custom shape files into SQL Server 2008, but there is no SRID for my custom coordinate system, so I just use 0. Since it is a projected (flat) coordinate system I'm using the Geometry data type. When I do this I can successfully open and view the layer in Map Suite, but I cannot re-project. When I try I get an error from MapSuite:
System.NotSupportedException was unhandled
Message=GeometryCollection is not supported now.
Source=MapSuiteCore
StackTrace:
at ThinkGeo.MapSuite.Core.Projection.x479147ab5a3dca02(Byte[] x61ddc1291c0e3204)
at ThinkGeo.MapSuite.Core.Projection.ConvertToExternalProjection(Feature feature)
at ThinkGeo.MapSuite.Core.FeatureSource.ConvertToExternalProjection(Feature feature)
at ThinkGeo.MapSuite.Core.FeatureSource.ConvertToExternalProjection(IEnumerable`1 features)
at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesForDrawing(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.MainDraw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x03e3d48bcfe7bb6c(IEnumerable`1 xa6f0db4f183189f1)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xff5b27c00f9678c2(RectangleShape x178b193eec228e6e)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe3cee4adb9c72451()
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at MapTutorial.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
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:
Any ideas or am I just out of luck?
Thanks,
Steve