I am trying to display a pair of .shp/.dbf files in xamGeographicMap that gives the exception shown below when I try to load it. I am able to open this file set in ArcGIS and Google Earth Pro without any issues. My XAML is also shown below and I am using v14.2.20142.2024. Due to NDA and copyright agreements, I cannot upload the files, but what might cause this error in xamGeographicMap or what could I do to determine more information?
<ig:ShapefileConverter x:Key="fileSource" ImportCompleted="file_ImportCompleted" ShapefileSource="Q:\GIS\file.shp" DatabaseSource="Q:\GIS\file.dbf"> </ig:ShapefileConverter>
<ig:GeographicSymbolSeries x:Name="fileSeries" MarkerTemplate="{StaticResource fileMarker}" ItemsSource="{StaticResource fileSource}" LatitudeMemberPath="Lat" LongitudeMemberPath="Lon" VisibleFromScale=".01"> <ig:GeographicSymbolSeries.ToolTip> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <TextBlock Text="{Binding Path=Item.Info, Converter={StaticResource Converter}}" Background="Aqua" /> </StackPanel> </ig:GeographicSymbolSeries.ToolTip> </ig:GeographicSymbolSeries>
System.Exception was unhandled HResult=-2146233088 Message=Corrupt Shp file - failed to read None Source=InfragisticsWPF4.Controls.Maps.XamGeographicMap.v14.2 StackTrace: at Infragistics.Controls.Maps.ShapeFileUtil.ReadShape(Header shapeHeader, BinaryReader shpReader, BinaryReader dbfReader) at Infragistics.Controls.Maps.ShapefileConverter.ParseShapes(BinaryReader shpReader, BinaryReader dbfReader) at Infragistics.Controls.Maps.ShapefileConverter.<ImportAsync>b__2(Object sender, GetBinaryReadersCompletedEventArgs e) at Infragistics.Controls.Maps.MultiUriProcessor.OnGetBinaryReadersCompleted(GetBinaryReadersCompletedEventArgs e) at Infragistics.Controls.Maps.MultiUriProcessor.<>c__DisplayClass2.<GetBinaryReadersAsync>b__0(Object sender, EventArgs e) at Infragistics.Controls.Maps.MultiUriProcessor.ProgressMonitor.OnCompleted() at Infragistics.Controls.Maps.MultiUriProcessor.ProgressMonitor.CheckComplete() at Infragistics.Controls.Maps.MultiUriProcessor.ProgressMonitor.RegisterComplete(Object part, Boolean complete) at Infragistics.Controls.Maps.MultiUriProcessor.<>c__DisplayClass4.<GetBinaryReadersAsync>b__1(Object sender, GetBinaryReaderCompletedEventArgs e) at Infragistics.Controls.Maps.UriProcessor.OnGetBinaryReaderCompleted(GetBinaryReaderCompletedEventArgs e) at Infragistics.Controls.Maps.UriProcessor.<GetBinaryReaderAsync>b__0(Object sender, OpenReadCompletedEventArgs e) at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e) at System.Net.WebClient.OpenReadOperationCompleted(Object arg) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at GeoMapTest.App.Main() in c:\Projects\Sandbox\GeoMapTest\GeoMapTest\obj\Debug\App.g.cs:line 0 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Hello Gary,
I have been looking through our source code and it appears that the "None" in the exception you are seeing is coming from the ShapeType object that the XamGeographicMap is picking up on after reading your shape file. The shape file gets read row by row to get the ShapefileRecord objects from it. When each row is read, it is cast to a ShapeType object and is checked in a switch statement on that shape type.
While the shape types are being checked, there is a null ShapefileRecord object. If the shape type mentioned above is a type of Point, PolyLine, Polygon, PolylineZ, or PolyPointZ, the ShapefileRecord object gets set, and no exception is thrown. If the shape type is anything else, the row remains null and triggers the logic of an if statement that throws a new exception reading "Corrupt Shp file - failed to read " + shapeType.ToString().
By the above logic it appears that there is a row being read in your Shp file somewhere that is ShapeType "None", which is why you are seeing the exception you are seeing.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
Hi Andrew, thanks for your research. Unfortunately, I am not able to provide the shape file. One thing I did not mention is I get this in the VS designer/XAML view without starting the app - this is VS trying to show a preview of the control in the XAML view and therefore attempting to create a visual display with the shape file data), but I get the same error running the app as well.
I had considered the idea that the control could not find the shape file (i.e. the path was wrong), however, if I change the name slightly (ex to ShapefileSource="Q:\GIS\xfile.shp") the control has no issue loading the rest of the shape files.
I also have tried giving it a zero length .SHP file, which gives me "EndOfStreamException: Unable to read beyond the end of the stream." I had the same result giving it a zero-length .DBF file:
ShapefileSource="Q:\GIS\empty.shp" DatabaseSource="Q:\GIS\file.dbf">
And I tried providing it with junk files for .SHP and .DBF with similar results ("Corrupt Dbf file - wrong version number", "Corrupt Shp file - incorrect file code").
From these tests, it points to the control having an issue reading the shape file itself. Can you look at the source code and see where the text "Corrupt Shp file" is and what data it uses to provide error messages - in this case, does it explicitly us the text "None", or does that come from the shape file data, or what logic path may cause this error message?
Thank you for your post.
This error is generally thrown when the XamGeographicMap cannot correctly read the shape file. I have been looking at the exception you have pasted here, and at the top it reads "Corrupt Shp file - failed to read None." This tells me that unless the name of your shape file is "None", then the XamGeographicMap is not finding the file at all.
For me to truly find the cause of this though, I believe that I will need to reproduce this issue using a shape file from you that reproduces this issue. I understand that you cannot upload this file to these forums, and so in hopes that you can upload it privately, I have created a private case for you for this matter. This case has a case ID of CAS-150654-K4D5X8. You can access this case through this link: https://es.infragistics.com/my-account/support-activity.
Would it be possible for you to reply to that case with a shape file attachment or sample application that reproduces this issue?