ThinkGeo.com    |     Documentation    |     Premium Support

Shapefile Performance

Hello,


I have shapefiles for several different countries and as I load more of the shapefiles that I have, drawing performance starts to significantly decrease, even when I'm zoomed into an area where few shapefiles should actually be drawn.


For example, if I load shapefiles in the US, it takes between 3 and 5 seconds to draw. If I then load all my shapefiles in Italy, and am still zoomed into a city in the US, drawing time increases to more than 15 seconds.


I have index files created for all of these shapefiles and custom indexes for any shapefiles I am using ValueStyles for.


Just for fun, before asking the map to draw, I added some code to loop through all the layers to see if their bounding boxes overlap the current map extent. If they do, I set their IsVisible to true and if not, I set it to false. I noticed an incredible performance difference. From over 15 seconds to draw to less than 5 seconds.


This seems like something the WinformsMap should be handling itself. Is there something else that I could be doing wrong? Should I be doing this? Is there anything else I can do to help drawing performance?


Any help would be greatly appreciated.


Thanks!



Jennifer, 
  
 Thanks for your post. Welcome you to ThinkGeo Destkop Discussion forum. 
  
 I reviewed the code snippet for this part and do not think this case should happen. Let us say in your example given above. 
  
 Drawing US separately :  3~5 seconds. 
 Drawing Italy: 10 seconds. 
  
 If the current extent do not include any features in Italy, then it will not bother to draw it. While it does need to fetch data from it, and the returning data is expected to be 0 features. 
  
 So, as you described, I have following doubts: 
 1) Can you check that the current extent to get features from Italy shape file to see it really returning 0 features? You can use the API in FeatureSource: GetFeaturesForDrawing. 
 2) Can you verify that Index file for the Italy is right? It should be composed of 2 files(.idx and .ids), which is different with Map suite 2.0 versions. 
  
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale