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,
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?
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?
Hi Andrew, thanks for looking into this further. Just to verify, this error message is generated when reading in the .SHP file and NOT the .DBF file, correct?
Hi Gary,
Andrew is out for the rest of the week but I can answer your question. Yes, the error message is generated by reading the shp file. The shape types (point, polyline, polygon, etc) that Andrew mentioned are things that are present inside of the shape file, not the dbf.
Thanks Rob, so based on the information above and looking at both Wikipedia (http://en.wikipedia.org/wiki/Shapefile) and the ERSI shapefile technical documentation (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf), a "Null" shape type is valid in the file, but the xamGeographicMap does not support shapefiles containing that type, correct?
Any suggestions or workarounds I can try to surmount loading this into xamGeographicMap?
Thanks!
Judging by the source code of the control, the shape types that are valid for reading into the XamGeographicMap are Point, Polygon, PolyLine, PolyLineZ, and PolyPointZ. If you currently try to read in other shape types, you will receive this exception. A workaround for this issue could be to pull the shapes that the XamGeographicMap does not currently support out of the shape file by using a shape file editor.
Alternatively, you could suggest a new product idea for some new functionality that will either implement or ignore these currently unsupported shape types to the XamGeographicMap. The website for suggesting a new product idea is http://ideas.infragistics.com/. Suggesting a new product idea will allow you to have direct communication with our product management team regarding your idea and you will receive notifications when new information regarding your idea becomes available.
Steps to create your idea:1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com.2. Navigate to the product/platform channel of your choice(e.g. WPF, Windows Forms, ASP.NET, etc).3. Add your product idea and be sure to be specific and provide as much detail as possible.
The Product Idea site puts you in the driver's seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Thanks Andrew, I have submitted this as a new feature. In order to get around this issue, I had to use a free .NET library called EasyGIS to read in the point data and write it out to a new shapefile.