ThinkGeo.com    |     Documentation    |     Premium Support

Can we use ValueStyle for adding markers

 actually i want to add 5000 markers on the map at a time.for this iam getting performance issue.so can i use value style to add markers in web edition.so that we can improve performance of the map.


  if i use inmemoryfeaturelayer or cluster  markerstyle iam not able to display different images for markers.so by using value style can we display markers with different image.


 


 



Hi Raj, 
  
 Please try the following code. 
  
                 ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(@"SampleData\Data\majorcities.shp"); 
  
                 ValueStyle style = new ValueStyle(); 
                 style.ColumnName = "POP2000"; 
                 style.ValueItems.Add(new ValueItem("1321045", new PointStyle(new GeoImage(MapPath(@"…/…/theme/default/img/marker_blue.gif"))))); 
                 style.ValueItems.Add(new ValueItem("3694820", new PointStyle(new GeoImage(MapPath(@"…/…/theme/default/img/marker.gif"))))); 
                 style.ValueItems.Add(new ValueItem("1223400", new PointStyle(new GeoImage(MapPath(@"…/…/theme/default/img/map.gif"))))); 
                 style.ValueItems.Add(new ValueItem("554636", new PointStyle(new GeoImage(MapPath(@"…/…/theme/default/img/marker_gold.gif"))))); 
  
                 layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(style); 
                 layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 
  
                 LayerOverlay overlay = new LayerOverlay(); 
                 overlay.Layers.Add(layer); 
  
                 layer.Open(); 
                 Map1.MapUnit = GeographyUnit.DecimalDegree; 
                 Map1.CurrentExtent = layer.GetBoundingBox(); 
                 Map1.CustomOverlays.Add(overlay); 
  
 Regards, 
 Edgar