ThinkGeo.com    |     Documentation    |     Premium Support

What performance should I Expect?

I am new to MapSuite and would like to ask a few simple questions about performance.


 


I am running mapsuite 3.0 which I just purchase and downloaded today.


Even with only one LayerOverlay and one Layer in that overlay, My map takes 2-4 seconds to refresh on any zoom or pan.  I assume this is not to be expected.  Can someone help me with this code?  This code is within a class derived from WinFormsMap.


 



            string fileName = @"fe_2007_us_state/fe_2007_us_state";
            string fname = _mappath + fileName;
            if (!File.Exists(fname + ".idx")) ShapeFileFeatureLayer.BuildIndexFile(fname + ".shp");

            MapUnit = GeographyUnit.DecimalDegree;
            MapResizeMode = MapResizeMode.PreserveExtent;
            ZoomLevelSnapping = ZoomLevelSnappingMode.None;

            BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(fname + ".shp");
            layer.DrawingMarginPercentage = 0;
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
            layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.State1("Name");
            layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new QualityFamilyAreaStyle(new GeoPen(GeoColor.StandardColors.Black), GeoColor.SimpleColors.PaleGreen, 52);

            LayerOverlay overlay = new LayerOverlay();
            overlay.Layers.Add(layer);
            Overlays.Add(overlay);


I should add to this topic that the shape file I am adding is a simple national and state outline. 



Jim, 
  
   What is the file size of the fe_2007_us_state shape file?  It is odd to get speeds that slow.  Not that this will maek a difference but you are setting the default area style twice, once to country1 and the next to the quality family style.  Try not to use the quality family style and see if that is what is slowing it down. 
  
 David

Jim, 
  
   On the Layer and Overlya there should be a property for render time and labeling time I think.  You can look at that once it has rendered to make sure it is the layer drawing that takes the time.  I suspect the quality family style as you are creating 52 variants and I wonder the code around that in our stuff is inefficiently.  I know we draw things liek the countries of the world in like 100ms or something like that.  Something must be very wrong to get 2 seconds. 
  
 David

I have disabled the quality family and see no difference in the drawing time … 
 The shape files is 10 mb. 
 The drawing time is coming out as: .476 seconds.  But I don’t think I am that crazy, the screen definitely is not updating in that time.

Jim, 
  
  Can you check your threading mode property on the map control?  Just verify it is single threaded.  Also 10 meg is not huge but it is larger them the countries of the world which comes in at 3.7 meg.  I think the .467 seconds is correct but something else must be afoot.  Can you package up a small sample app that is complete, not just the code fragment?  We can test it here with a 10 meg shape file.  Also just to make sure though I am sure it is ok can you check to be 100% for the shapefile there is an idx and idx file with them? 
  
 David 


Jim, 
  
   If we still can’t get it them if you are up for it we can arrange a gotomeeting to check it out in realtime.  This might save a bunch of time. 
  
 David

I’m fine with a gotomeeting - how do we proceed?

I have checked the threading model - it was set to 'default'.  Setting it to 'singlethreaded' did not effect anything.


I have boiled down my project into a simple reproduction.  I simply created a new c# 2008 project and dropped a WinFormsMap on the form and docked it to fill.


I then added this code to the form_load:


 



        private void Form1_Load(object sender, EventArgs e)
        {        
            string _mappath = @"C:\Documents and Settings\jneumann\My Documents\Shapefiles\tiger\";
            RectangleShape usExtent = new RectangleShape(-125.0, 50.0, -66.0, 23.0);
            string fileName = @"fe_2007_us_state/fe_2007_us_state";
            string fname = _mappath + fileName;
            if (!File.Exists(fname + ".idx")) ShapeFileFeatureLayer.BuildIndexFile(fname + ".shp");

            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.MapResizeMode = MapResizeMode.PreserveExtent;
            winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None;

            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(fname + ".shp");
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
            layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.State1("Name");

            LayerOverlay overlay = new LayerOverlay();
            overlay.Layers.Add(layer);
            winformsMap1.Overlays.Add(overlay);
            winformsMap1.CurrentExtent = usExtent;
            winformsMap1.Refresh();

        }


That is the entire project.  Even with the window tiny, doubleclicking takes about 2 seconds to refresh.  Once you zoom in enough times, the refresh does get faster, but then as you zoom out, it slows down again.

Any help would be appreciated.  Perhaps this is the expected speed.  But that would be a bit disappointing :)

Jim

www2.census.gov/geo/tiger/TIGER2007FE/fe_2007_us_state.zip 
  
 This is the link to the shapefile I am using.

www2.census.gov/geo/tiger/TIGER2007FE/fe_2007_us_state.zip 
  
 This is the link to the shapefile I am using.

Jim,


Thanks for your post.
 
I tested against your data and found 2/3 of time was spent on the labeling. Following is the detailed result. It seems labeling take a bit longer than expected in this data.
 
Data size: 10.3 Megabytes
Symbol time is: 725 ms
Symbol And Label time is: 2150 ms
 
Also, we tested that some other data attached in our package:
 
Data : Counties02
Data size: 3.63 Megabytes
Symbol time is: 210 ms
Symbol And Label time is: 403 ms
 
Data : AustinStreets
Data size: 1.21 Megabytes
Symbol time is: 237 ms
Symbol And Label time is: 862 ms
 
Data : USStates
Data size: 217 Kb
Symbol time is: 125 ms
Symbol And Label time is: 186 ms
 
Thanks.
 
Yale

Is there anything I can do about this?  Is there some attribute of the data that causes it to be slower?  Where are you getting the USStates data that you cite in your last example?  The data file I am using is also US States, perhaps I can change my source. 
  
 Jim

Jim, 
  
  The data that Yale used for states came along with our samples.  Check around the directory below.  The file is smaller because it is designed to be shown while you are zoomed out.  The file you have which is 3 meg has much more detail and that is why it is rendering more slowly.  One technique people us is to use generalized smaller files with less detail when you are zoomed out and then as people zoom in switch to higher detailed files.  There is no reason to display higher detail files when you are zoomed out as much of the detail will just fit into a single pixel.  Each set of data is usually designed for a particular scale, they won’t usually say but you can look at the data and judge by the file size and looking at it what kind of detail it has.  When the user zooms in to a articular point you can switch out to the detailed data and it will draw fast because at the zoomed in area it might only need to draw 3 records out of the 50. 
  
   Having said all of that I think the reason things might slow down more as well is that you are labeling the high detail polygon which caused allot of detail to be considered when it doesn’t really need to be.  I think you will find much better performance to use the generalized shape file at the directory below.  Finding data for particular uses for free is many times a hit or miss proposition.  This is one of the reasons we create the World Map Kit to get a bunch of data and manipulate it specifically for drawing quickly and having the right amount of detail at the right level. 
  
 C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0\Samples\SampleData\Data 
  
 I am posting a video showing you what I mean.  It will be ready in a few minutes. 
  
 David

Jim, 
  
   I have a link to the video.  I think the video shows much better what I mean.  Let me know what you think. 
  
 download.thinkgeo.com/videos/forums/DetailLevelsVideo.wmv 
  
  
 David

Thanks.  I have done as you suggested and the map is much more responsive.

Jim, 
  
   Great news.  Let me know if there are any other road block you hit. 
  
 David