We have just upgraded to MS 10, WinForms. When we try to display GoogleMaps in a projections other than its native one, we get the following execption:
System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.WaitAll(Task tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at ThinkGeo.MapSuite.Layers.GoogleMapsLayer.FjY=(RectangleShape canvasExtentForGoogleDrawing, Int32 zoomLevelsNumber, Double scale)
at ThinkGeo.MapSuite.Layers.GoogleMapsLayer.FTY=(GeoCanvas canvas)
at ThinkGeo.MapSuite.Layers.GoogleMapsLayer.DrawCore(GeoCanvas canvas, Collection1 labelsInAllLayers) at ThinkGeo.MapSuite.Layers.Layer.dyQ=(GeoCanvas canvas, Collection1 labelsInAllLayers)
at ThinkGeo.MapSuite.Layers.Layer.Draw(GeoCanvas canvas, Collection1 labelsInAllLayers) at ThinkGeo.MapSuite.WinForms.LayerOverlay.DrawCore(GeoCanvas canvas) at ThinkGeo.MapSuite.WinForms.Overlay.9FI=(GeoCanvas canvas) at ThinkGeo.MapSuite.WinForms.Overlay.Draw(GeoCanvas canvas) at ThinkGeo.MapSuite.WinForms.WinformsMap.rVI=(IEnumerable1 drawingOverlays, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.rFI=(RectangleShape drawingExtent, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.y1I=(RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.fhU=(Int32 delayInterval, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.Refresh()
at MapSuite_Desktop1.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\ZipPa\Documents\Visual Studio 2015\Projects\ThinkGeo\GoogleMapsTest\Form1.vb:line 26
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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)
InnerException:
HResult=-2146233079
Message=failed to load NAD27-83 correction file
Source=ThinkGeo.MapSuite
StackTrace:
at ThinkGeo.MapSuite.Shapes.Proj4Projection.wCI=(Int32 errorNumber)
at ThinkGeo.MapSuite.Shapes.Proj4Projection.ConvertToExternalProjectionCore(Double x, Double y)
at ThinkGeo.MapSuite.Shapes.Projection.yiI=(Byte wellKnownBinary)
at ThinkGeo.MapSuite.Shapes.Projection.xyI=(Byte wellKnownBinary)
at ThinkGeo.MapSuite.Shapes.Projection.wyI=(Feature feature)
at ThinkGeo.MapSuite.Shapes.Projection.ConvertToExternalProjection(BaseShape baseShape)
at ThinkGeo.MapSuite.Layers.GoogleMapsLayer.FzY=(Object tileInfo)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
InnerException:
I have attached a sample project for you to see the problem.
I tried your sample application. I assume that you have a valid key in your application, but a key isn’t needed for testing purposes. I actually commented out that whole line.
Protected Overrides Sub OnCreatingRequest(e As CreatingRequestGoogleMapsLayerEventArgs)
'e.RequestUri = New Uri(e.RequestUri.AbsoluteUri + "&key=")
MyBase.OnCreatingRequest(e)
End Sub
Before that though, my first issue was getting the references correct. I went ahead and updated your references to 10.2. I noticed that the package manager was showing ThinkGeo.MapSuite.Shapes.UnmanagedProj4Projection installed, but it wasn’t installed correctly (This could have been a local issue for me). I removed that reference, and I reinstalled it. Despite VS 2017 saying it was using the package, it didn’t include the folders in the output location (There should be 4 folders copied to the output location. Windows-X86, Windows-X64, Linux-X86, and Linux-X64), and I was getting errors thrown at me . After the reinstall, it worked great without error.
I made no changes other than the one comment to your code. These are your packages:
<?xml version="1.0" encoding="utf-8"?>
These are the ones I used:
<?xml version="1.0" encoding="utf-8"?>
Hopefully, that will get you what you need. I think the issue might be that your packages are different versions. If you update, I would recommend doing ThinkGeo.MapSuite first. Then, updating the rest. Having done this several times myself recently, the package manager will tell you that ThinkGeo.MapSuite 1.0 (1.1) does not meet the prerequisites for all the other 10.2 packages and fail. Update that one individually, then the others will update without issue. Good Luck!
Thanks for taking the time to respond. I would love to upgrade to MS 10.2 or 10.2.1 but I can’t. In our application we use the print preview capabilities of MS to create a Page-Layout view for printing, which relies on PrinterInteractiveOverlay. This class works fine in 10.0 but will not work in later versions. I don’t know how or why, but this class is listed twice in the object browser in VS and if you try to create an instance of it you get the ‘name is ambiguous in the namespace’ error message and the project will not compile.
I have not been successful in getting the GoogleMaps issue solved in version 10.0.
So, ThinkGeo guys, any idea about when PrinterInteractiveOverlay will work in a current version of MS?
We have been using Srid 102003 since MS began supporting reprojection of raster layers (a number of years). It works fine in ThinkGeo 9. And the ability to display Google Maps in this coordinate system is a key part of our application.
Also, if I try to use Srid 26916 that fails as well.
I don’t think you guys have removed support for this projection. I think the error in my original sample is misleading you. And it was confusing to me also.
I re-created another sample from scratch (instead of starting with an old one). I am using all MS 10.2 or MS 10.21 assemblies. Now I am getting a different error, and I think it might be helpful. The exception I am now receiving suggests that MapSuite cannot find the Unmanaged Proj4 Dependencies, even though they have been added to the project.
Our developer found it should be an issue for Proj4Projection, so the workaround is to use UnmanagedProj4Projection, you should want to download this package: ThinkGeo.MapSuite.Shapes.UnmanagedProj4Projection.
As below is the code and the screen shot:
Dim oProj As New UnmanagedProj4Projection
With oProj
.InternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString
.ExternalProjectionParametersString = Proj4Projection.GetEsriParametersString(26916)
.Open()
End With