ThinkGeo.com    |     Documentation    |     Premium Support

Build Index error in Silverlight

Good Day to you,


I am attempting to implement a simple select and zoom-to function based on a client's click location on the map.  The shapefile that we are using must be too large, because the getNearestTo function takes several seconds to respond.  Presumably, we need an index to remedy this situation.  None of our CAD tools export IDS or IDX files, so we are attempting to use the ShapeFileFeatureLayer.BuildIndexFile() command to provide the necessary performance.  When this line is executed, however, we get an error, as seen below:



ShapeFileFeatureLayer.BuildIndexFile(


"USGS Place Names.shp")


System.MethodAccessException was unhandled by user code

  Message="Attempt to access the method failed: System.IO.File.Exists(System.String)"

  StackTrace:

       at ThinkGeo.MapSuite.SilverlightEdition.ShapeFileFeatureSource.BuildIndexFile(String shapePathFilename, String indexPathFilename, Projection projection, String columnName, String regularExpression, BuildIndexMode buildIndexMode, Encoding encoding)

       at ThinkGeo.MapSuite.SilverlightEdition.ShapeFileFeatureSource.BuildIndexFile(String shapePathFilename, String indexPathFilename, Projection projection, String columnName, String regularExpression, BuildIndexMode buildIndexMode)

       at ThinkGeo.MapSuite.SilverlightEdition.ShapeFileFeatureSource.BuildIndexFile(String shapePathFilename)

       at ThinkGeo.MapSuite.SilverlightEdition.ShapeFileFeatureLayer.BuildIndexFile(String pathFilename)

       at ThinkGeoPOC.MainPage.MainPage_Loaded(Object sender, RoutedEventArgs e)

       at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)

       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

  InnerException: 

 


Any ideas?


Thank you,


diamond



Hi Diamond, 
  
 The problem is that we cannot modify the files on the client side but only read the resource and stream on the client side. Please try to write this code on the server side which will get you the right index files. 
  
 Please let me know if you have more questions. 
  
 Thanks, 
 Howard

Thank you Howard.

Diamond, 
  
 No problem. Please let me know if you have more questions. 
  
 Thanks, 
 Howard