ThinkGeo.com    |     Documentation    |     Premium Support

Time difference default PointStyle to custom PointStyle

I use the InMemoryLayer with lots of PointShapes (about 45.000 points). If I use an custom style with an 6x6 pixel gif, the layer draws circa 9000 ms. If I use PointStyles.City1 for example, the drawing time is circa 2700 ms. A PointStyle with PointSymbolType loads only 800 ms.


Option 1 - default style --> circa 2700ms for 45.000 points 


inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.City1);

Option 2 - style with PointSymbolStyle --> circa 800 ms for 45.000 points


inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(new PointStyle(PointSymbolType.Star, new GeoSolidBrush(GeoColor.StandardColors.Yellow), 7));

 


Option 3 - style with GeoImage (6x6 pixel) --> circa 9000 ms for 45.000 points 


inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(new PointStyle(new GeoImage(Server.MapPath("~/images/my_symbol.gif"))));

Why are the differences between the drawing time of these 3 point styles so extreme?


The drawing times I have determine with the OnLayersDrawn event of the map.


 


Anke



 


Anke,
 
Thanks for your performance investigation, that’s the part we are always very interested in.
 
I made the same tests and got the similar results. I think our results make sense that the more complex the symbol is, the longer it will take to draw them out.  PointStyles.City1 is composed of an inner filled circle, an outer filled circle, and a black outline pen, which is three times more complex than the Star Style (new PointStyle(PointSymbolType.Star, new GeoSolidBrush(GeoColor.StandardColors.Yellow), 7)), that’s why it takes three longer time. I also tried PointStyles.City7, as it’s very simple, the speed is much faster. Style with GeoImage is supposed to be slower as it reads icon from disk, which is a slow operation, also drawing an image is more complex than drawing a simple figure, such as a circle or rectangle. When you look at a symbol its speed will usually be determines by how many fills and outlines it has, the fewer the better.
 
     
(For more predesigned GeoStyle themes please click here)
 
Here are some of my test results and you can see it’s similar with yours.



    
        
            
             
            
            
            Style
            
            
            Time(s)
            
        
        
            
            A
            
            
            PointStyles.GetSimpleCircleStyle(GeoColor.StandardColors.Red, 3f)
            
            
            0.87
            
        
        
            
            B
            
            
            City7
            
            
            1.78
            
        
        
            
            C
            
            
            PointStyles.GetSimpleCircleStyle(GeoColor.StandardColors.White, 3.2F, GeoColor.StandardColors.Black, 1F)
            
            
            1.88
            
        
        
            
            D
            
            
            new PointStyle(PointSymbolType.Star, new GeoSolidBrush(GeoColor.StandardColors.Yellow), 7)
            
            
            3.06
            
        
        
            
            E
            
            
            City 1
            
            
            3.54
            
        
        
            
            F
            
            
            new PointStyle(new GeoImage(Server.MapPath("~/images/Explorer.ico"))) (the ico is 32*32)
            
            
            16.75
            
        
    


 
Thanks for your attention to Map Suite products as your interest can always make us being better. For any more queries please let us know.
 
By the way: Why do you have 45,000 points in memory. I wonder if maybe there is a better way to store them to give you better performance. Some of the time will not only be spent on drawing but also to determine is all 45,000 points are in the current extent. There is also memory overhead to have all of this in memory.
 
Ben.
 

54-city1.JPG (1.68 KB)
55-city7.JPG (1.54 KB)