ThinkGeo.com    |     Documentation    |     Premium Support

Pan and performance

Hello all


I have some problems must to solve.


1) when i pan the map on some location, it will throw an error: system.InvalidOperationException: your input index is out of bound.


what reasons may cause this error?


2) could you tell me more about reasons of affect the performance/speed? (i have post this question on ThinkGeo Customer Portal, but i still don't get any response)


if i want to modify file size, i have to concern which file type? .shp or . dbf?


 



Carol,


Thanks for your post, hope my following answer can give you some hints.
 
1)      The reason for your operation is probably hidden in the data. If you want, you could send me the data causing this error as well as let me know the extent when you have this problem happening.
2)      There are couple of reasons probably affect the performance of speed.
1)      ZoomLevel settings for data.
2)      Data complexity.
3)      Cache setting etc.
3)      If you want to modify file size, all the five files are need to be concerned.(.shp, .shx, .dbf and .idx and .ids) , of course, the last two index files can be rebuild by using our API very easily.
 
Please feel free to let me know any more questions.
 
Thanks.
 
Yale

Thanks for your suggestion, Yale 
 1) my overlay contains many shapefilefeaturelayer, so I think I have to know firstly which layer causes this error. :( 
 2) sorry, i want to make sure these problems. i want to know reasons affect the performance of speed of map loading/paning/zoomming. (i think loloading/paning/zoomming map is related) 
 if i load my data and show map, i think file size is important reason, right? 
  
 you give me 3 reasons 
     1) ZoomLevel settings for data. 
 i think your mean is zoomlevel setting of loading code, right? 
     2) Data complexity. 
 i feel confused in this, you mean data structure? or  number of records? or anything else? 
 in this point, does anything i can change in my data? 
     3) Cache setting etc. 
 could you explain it clearly? 
 i have setting a InMemoryBitmapTileCache in my loading code. 
 Dim InMemoryBitmapTileCache As InMemoryBitmapTileCache = New InMemoryBitmapTileCache() 
 worldOverlay.TileCache = InMemoryBitmapTileCache  
  
 3)  If you want to modify file size, all the five files are need to be concerned.(.shp, .shx, .dbf and .idx and .ids) , of course, the last two index files can be rebuild by using our API very easily. 
 i want to modify my file size, because i’d like to decrease load/pan/zoom time. 
  
 if you can, please tell me more idea. :) 
  
 Thanks. 


Carol, 
  
 Thanks for your post. 
  
 1) I think you are on the right way, you have to know which layer cause this problem and then probably we can figure it out. 
  
 2.1) ZoomLevel Setting: Yes, you are right. For example, if you want to load the local street data in a very high zoomlevel(zoomLevel 8 or something), it will absolutely very slow because too many features involved in that zoomLevel. 
 2.2) Data complexity. What I mean is the complexity for the features contained in the data. For example, one simple polygon may contains 3 or 4 points, while a very complex polygon may contains hundreds of Rings and each ring may contains hundreds of points. 
 2.3)In you case, you set the InmemoryBitmapTileCache, so every time you restart your application, the cache will be lost, and the memory will go up very  fast when you pan more and more. Of course, if you application was limited in a very small range of area, that would be very efficient. 
  
 3) As I understanding, what you mean by modifying is to divide your shape files into multiple shape files, right? I do not think you can speed it up very obviously if you still want to show the same features as before. 
  
 Please feel free to let me know any more questions. 
  
 Thanks. 
  
 Yale 


Thanks for your reply, Yale 
  
 2.2) Data complexity. What I mean is the complexity for the features contained in the data. For example, one simple polygon may contains 3 or 4 points, while a very complex polygon may contains hundreds of Rings and each ring may contains hundreds of points. 
 so, i can’t modify anything, right? 
 but, i see my .geo file of county. i don’t know why one county have many records to render. 
 i think if i merge some records to one, i don’t know it is helpful to map performance. 
 if you don’t understand what i mean, i have upload a .geo file to my ThinkGeo Customer Portal. 
 (i don’t know which software can open .shp file without coding and watch its detail coordinates data.) 
  
 2.3)In you case, you set the InmemoryBitmapTileCache, so every time you restart your application, the cache will be lost, and the memory will go up very fast when you pan more and more. Of course, if you application was limited in a very small range of area, that would be very efficient.  
 i just know Cache about InmemoryBitmapTileCache and FileBitmapTileCache 
 i don’t want to increase data in user disk, so i think InmemoryBitmapTileCache  is better. 
 or, could you have any idea? 
  
 3) As I understanding, what you mean by modifying is to divide your shape files into multiple shape files, right? I do not think you can speed it up very obviously if you still want to show the same features as before.  
 Sorry, maybe i describe unclearly. this question like 2.2) 
 i don’t want to divide many shp file. i just want to delet useless data. (ex. useless column in .dbf file or merge many records to one record in .shp file…etc) 
 i think decrease file size maybe can reduce time of map load/pan/zoom. i’m not sure i mistake or not. 
  
 please tell me more idea. 
 Thanks.

Carol, 
  
 I got your ticket today. I will do some research on this data and reply it on your ticket then. 
  
 Besides, about the cache, if you really do not want to add Files to your disk, you have to use the InmemoryBitmapTileCache then as you said. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, 
 i’d like to read each county/record coordinates and show it.  
 could you give me some idea? (i want to use these coordinates to create a new feature and show it) 
  
 i try to use feature id to read each record. i use follows code, the feature doesn’t show anything. 
 this sample is reference of How do I/ Hightlight a feature on the map. 
  
   Private Sub btnHighlightAFeature_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHighlightAFeature.Click 
         Dim worldLayer As FeatureLayer = WinformsMap1.FindFeatureLayer(“WorldLayer”) 
         Dim highlightLayer As InMemoryFeatureLayer = DirectCast(WinformsMap1.FindFeatureLayer(“HighlightLayer”), InMemoryFeatureLayer) 
  
         worldLayer.Open() 
         Dim feature As Feature = worldLayer.QueryTools.GetFeatureById(“1”, New String(-1) {}) 
         worldLayer.Close() 
  
         highlightLayer.InternalFeatures.Clear() 
         highlightLayer.InternalFeatures.Add(“1”, feature) 
  
         WinformsMap1.Refresh(WinformsMap1.Overlays(“HighlightOverlay”)) 
     End Sub 
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
         WinformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean) 
  
         Dim worldLayer As New ShapeFileFeatureLayer((“D:\GIS\town.shp”)) 
         worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 
         worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)) 
  
         Dim highlightLayer As New InMemoryFeatureLayer() 
         highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 
         highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.StandardColors.Red)) 
  
         Dim worldOverlay As New LayerOverlay() 
         worldOverlay.Layers.Add(“WorldLayer”, worldLayer) 
         WinformsMap1.Overlays.Add(“WorldOverlay”, worldOverlay) 
  
         Dim highlightOverlay As New LayerOverlay() 
         highlightOverlay.Layers.Add(“HighlightLayer”, highlightLayer) 
         WinformsMap1.Overlays.Add(“HighlightOverlay”, highlightOverlay) 
         WinformsMap1.CurrentExtent = New RectangleShape(121, 26, 122, 23) 
         WinformsMap1.Refresh() 
     End Sub

Hello, Yale 
 You can omit my problem about one county has many records. 
 I think I know why it has many records. 
 each record contains many points, i think if i decrease numbers of point that can help improve performance of map paning, right? 
  
 if you know any idea which could help me to improve performance, please tell me. Thanks. 


Carol, 
  
 Thanks for letting me know this. I appreciate it very much. 
  
 Yes, decrease numbers of point is just like simplify the feature shape that would reduce the complexity of data that will improve some performance. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale