ThinkGeo.com    |     Documentation    |     Premium Support

MarkerClassBreak bug?

Hi,
 .MarkerOverlay(overlay =>
            {

                overlay.Name("MarkerOverlay")
                    .IsBaseOverlay(false)
                    .Columns(col => col.Add(new FeatureSourceColumn("LocationType", "INTEGER", 32)))
                        .ZoomLevelSet(zoomlevelSet =>
                        {
                            MarkerClassBreak classBreak0 = new MarkerClassBreak(0);
                            MarkerClassBreak classBreak1 = new MarkerClassBreak(1);
                            classBreak1.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage(@"/App_Themes/img/Places/High Detail/48x48/Places - High Detail Headquarters.png", 48, 48);
                            classBreak1.DefaultMarkerStyle.WebImage.ImageOffsetX = 0;
                            classBreak1.DefaultMarkerStyle.WebImage.ImageOffsetX = 0;
                            MarkerClassBreak classBreak2 = new MarkerClassBreak(2);
                            classBreak2.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage(@"/App_Themes/img/Places/High Detail/32x32/Places - High Detail Office Building 1.png", 32, 32);
                            classBreak2.DefaultMarkerStyle.WebImage.ImageOffsetX = 8;
                            classBreak2.DefaultMarkerStyle.WebImage.ImageOffsetY = 8;
                            MarkerClassBreak classBreak3 = new MarkerClassBreak(3);
                            classBreak3.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage(@"/App_Themes/img/Places/High Detail/24x24/Places - High Detail Industrial 2.png", 24, 24);
                            classBreak3.DefaultMarkerStyle.WebImage.ImageOffsetX = 12;
                            classBreak3.DefaultMarkerStyle.WebImage.ImageOffsetY = 12;

                            ClassBreakMarkerStyle classBreakStyle = new ClassBreakMarkerStyle("LocationType");
                            classBreakStyle.ClassBreaks.Add(classBreak0);
                            classBreakStyle.ClassBreaks.Add(classBreak1);
                            classBreakStyle.ClassBreaks.Add(classBreak2);
                            classBreakStyle.ClassBreaks.Add(classBreak3);
                            classBreakStyle.ColumnName = "LocationType";

                            zoomlevelSet.ZoomLevel01.CustomMarkerStyle = classBreakStyle;
                            zoomlevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                        });

            })


I found that without a  dummy  marker class break "classBreak0" in my razor code the "classBreak1" does not show on a map.


jm.


 



Hi Jean-Marie,


I setup a test using the ZoomLevelsOnMarkers layers sample application to test this but did not encounter the issue you describe.

In the cities_a.shp I modified the value of Miami's POP2000 column to 100000 and modified the first Marker ClassBreak to use a value of 200000. Here is my code and my result:
.CustomOverlays(overlay =>
              {
                  overlay.WorldMapKitWmsWebOverlay();

                  MarkerClassBreak classBreak1 = new MarkerClassBreak(200000);
                  classBreak1.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/info.png", 20, 19);
                  classBreak1.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                  classBreak1.DefaultMarkerStyle.Popup.AutoSize = true;
                  classBreak1.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                  classBreak1.DefaultMarkerStyle.Popup.BorderWidth = 1;

                  MarkerClassBreak classBreak2 = new MarkerClassBreak(400000);
                  classBreak2.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png", 40, 38);
                  classBreak2.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                  classBreak2.DefaultMarkerStyle.Popup.AutoSize = true;
                  classBreak2.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                  classBreak2.DefaultMarkerStyle.Popup.BorderWidth = 1;

                  MarkerClassBreak classBreak3 = new MarkerClassBreak(600000);
                  classBreak3.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png", 60, 56);
                  classBreak3.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                  classBreak3.DefaultMarkerStyle.Popup.AutoSize = true;
                  classBreak3.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                  classBreak3.DefaultMarkerStyle.Popup.BorderWidth = 1;

                  ClassBreakMarkerStyle classBreakStyle = new ClassBreakMarkerStyle("POP2000");
                  classBreakStyle.ClassBreaks.Add(classBreak1);
                  classBreakStyle.ClassBreaks.Add(classBreak2);
                  classBreakStyle.ClassBreaks.Add(classBreak3);

                  MarkerZoomLevelSet zoomLevelSet = new MarkerZoomLevelSet();
                  zoomLevelSet.ZoomLevel04.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/circle.png");
                  zoomLevelSet.ZoomLevel04.DefaultMarkerStyle.Popup.ContentHtml = "<b>[#AREANAME#]</b> city with <b>[#POP2000#]</b> thousand people.";
                  zoomLevelSet.ZoomLevel04.DefaultMarkerStyle.Popup.AutoSize = true;
                  zoomLevelSet.ZoomLevel04.DefaultMarkerStyle.Popup.BorderColor = GeoColor.StandardColors.Gray;
                  zoomLevelSet.ZoomLevel04.DefaultMarkerStyle.Popup.BorderWidth = 1;
                  zoomLevelSet.ZoomLevel04.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;
                  zoomLevelSet.ZoomLevel06.CustomMarkerStyle = classBreakStyle;
                  zoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;

                  overlay.FeatureSourceMarkerOverlay("Markers").FeatureSource(new ShapeFileFeatureSource(Server.MapPath("~/App_Data/cities_a.shp")))
                      .ZoomLevelSet(zoomLevelSet);
              })
 Here is the resulting image showing that the Miami point with a value of 100000 is displaying with the MarkerClassBreak that is added first to the ClassBreakMarkerStyle:




Hi Ryan, 
  
 The difference between your sample and my application is that I do not have different zoom level.  I have the classBreakStyle on the same zoom levels. 
  
 jm. 
  
 <code> 
 zoomlevelSet.ZoomLevel01.CustomMarkerStyle = classBreakStyle; 
                             zoomlevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 
 </code>

Hi Jean,


I simplified Ryan's code and got the same result with his.



              .CustomOverlays(overlay =>
              {
                  overlay.WorldMapKitWmsWebOverlay();

                  MarkerClassBreak classBreak1 = new MarkerClassBreak(200000);
                  classBreak1.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/info.png", 20, 19);
                  classBreak1.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                  classBreak1.DefaultMarkerStyle.Popup.AutoSize = true;
                  classBreak1.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                  classBreak1.DefaultMarkerStyle.Popup.BorderWidth = 1;

                  MarkerClassBreak classBreak2 = new MarkerClassBreak(400000);
                  classBreak2.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png", 40, 38);
                  classBreak2.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                  classBreak2.DefaultMarkerStyle.Popup.AutoSize = true;
                  classBreak2.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                  classBreak2.DefaultMarkerStyle.Popup.BorderWidth = 1;

                  MarkerClassBreak classBreak3 = new MarkerClassBreak(600000);
                  classBreak3.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png", 60, 56);
                  classBreak3.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                  classBreak3.DefaultMarkerStyle.Popup.AutoSize = true;
                  classBreak3.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                  classBreak3.DefaultMarkerStyle.Popup.BorderWidth = 1;

                  ClassBreakMarkerStyle classBreakStyle = new ClassBreakMarkerStyle("POP2000");
                  classBreakStyle.ClassBreaks.Add(classBreak1);
                  classBreakStyle.ClassBreaks.Add(classBreak2);
                  classBreakStyle.ClassBreaks.Add(classBreak3);

                  MarkerZoomLevelSet zoomLevelSet = new MarkerZoomLevelSet();
                  zoomLevelSet.ZoomLevel01.CustomMarkerStyle = classBreakStyle;
                  zoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;

                  overlay.FeatureSourceMarkerOverlay("Markers").FeatureSource(new ShapeFileFeatureSource(Server.MapPath("~/App_Data/cities_a.shp")))
                      .ZoomLevelSet(zoomLevelSet);
              })

Could you please have a try?


Regards,


Edgar



Hi Edgar,


 


we have to compare apple and apple, in your example you are using the  ".CustomOverlays(overlays =>" in my application I am using  " .MarkerOverlay(overlay =>"


 


jm



Hi Jean-Marie, 



I set this up with a .MarkerOverlay and was able to recreate the issue. I am seeing that with a Feature.ColumnValue of less than or equal to the ClassBreak that the Feature is not displayed. 



This behavior is different than what was demonstrated with the CustomOverlays(overlay) so we will need to take a closer look at this issue.



Hi Jean-Marie,


Upon closer review I realized that in my initial test of this issue I did not reference the correct shapefile and thusI encountered different results between the MarkerOverlay and the CustomOverlay examples. In my initial test code with the CustomOVerlay you will see that I used the default shapefile cities_a.shp, not a modified shapefile which contained the modified POP2000 value for Miami. So while I did modify Miami's POP2000 value in another shapefile, I did not reference the modified shapefile in my example which means my example screenshot was not based on the correct shapefile data. 



To test this issue correctly I setup a .MarkerOverlay example as you requested.


My test code:



.MarkerOverlay(overlay =>
{
ShapeFileFeatureSource source = new ShapeFileFeatureSource(Server.MapPath("~/App_Data/cities_a.shp"));
source.Open();
Collection<Feature> Features = source.GetAllFeatures(ReturningColumnsType.AllColumns);

       foreach (FeatureSourceColumn column in source.GetColumns())
       {
        overlay.Columns(col => col.Add(new FeatureSourceColumn(column.ColumnName, column.TypeName, column.MaxLength)));
       }
            foreach (Feature feature in Features)
            {
               Dictionary<string, string> values = feature.ColumnValues;
               overlay.Feature(new Feature(feature.GetShape(), values));
            }
              overlay.Name("MarkerOverlay")
              .IsBaseOverlay(false)
              .FeatureSource(new ShapeFileFeatureSource(Server.MapPath("~/App_Data/cities_a.shp")))
              .ZoomLevelSet(zoomLevelSet =>
               {
                MarkerClassBreak classBreak1 = new MarkerClassBreak(200000);
                classBreak1.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/info.png", 20, 19);
                classBreak1.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                classBreak1.DefaultMarkerStyle.Popup.AutoSize = true;
                classBreak1.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                classBreak1.DefaultMarkerStyle.Popup.BorderWidth = 1;

                MarkerClassBreak classBreak2 = new MarkerClassBreak(362470);
                classBreak2.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png", 40, 38);
                classBreak2.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                classBreak2.DefaultMarkerStyle.Popup.AutoSize = true;
                classBreak2.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                classBreak2.DefaultMarkerStyle.Popup.BorderWidth = 1;

                MarkerClassBreak classBreak3 = new MarkerClassBreak(600000);
                classBreak3.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png", 60, 56);
                classBreak3.DefaultMarkerStyle.Popup.ContentHtml = "Population in 2000 is 
[#POP2000#]";
                classBreak3.DefaultMarkerStyle.Popup.AutoSize = true;
                classBreak3.DefaultMarkerStyle.Popup.BorderColor = GeoColor.FromHtml("#CCCCCC");
                classBreak3.DefaultMarkerStyle.Popup.BorderWidth = 1;
   
             ClassBreakMarkerStyle classBreakStyle = new ClassBreakMarkerStyle("POP2000");
             //Test 1: Do not set a BreakValueInclusion, just use the default of IncludeValue
             //Test 2: Do not set a BreakValueInclusion, just use the default of IncludeValue
             //Test 3: The BreakValueInclusion is set to ExcludeValue.
             classBreakStyle.BreakValueInclusion = BreakValueInclusion.ExcludeValue;
                                  
             //Test 2: Disable ClassBreak1
             //Test 3: Disable ClassBreak1
             //classBreakStyle.ClassBreaks.Add(classBreak1);
             classBreakStyle.ClassBreaks.Add(classBreak2);
             classBreakStyle.ClassBreaks.Add(classBreak3);

             zoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage("../../Content/images/Industrial.png");
             zoomLevelSet.ZoomLevel01.CustomMarkerStyle = classBreakStyle;
             zoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            });

})

My findings were as follows:



        
  • Test 1: This is the same as you including classBreak0

        ClassBreak1 and ClassBreak2 are enabled.

        The default implementation of BreakValueInclusion is set to IncludeValue.

        ColumnValue in shapefile is set to exactly the BreakValue of classBreak2.

        

        Result:

        The Miami Marker displays using ClassBreak2's DefaultMarkerStyle.

         

  •     
  • Test 2:

        ClassBreak1 is disabled.

        The default implementation of BreakValueInclusion is set to IncludeValue.

        ColumnValue in shapefile is set to exactly the BreakValue of classBreak2.

        

        Result:

        The Miami Marker is not displayed.

         

  •     
  • Test 3:

        
    ClassBreak1 is disabled.

        The BreakValueInclusion is set toExcludeValue.

        ColumnValue in shapefile is set to exactly the BreakValue of classBreak2.

        

        Result:

        The Miami Marker is displayed.


By default the MarkerClassBreak uses BreakValueInclusion of .IncludeValue so I would expect that columnValues matching your ClassBreak1 would be drawn using your classBreak1.DefaultMarkerStyle but this does not seem to be the case.


Currently it seems that the only time that the marker.ColumnValue can match the BreakValue, not require a 'dummy' classBreak and be displayed is if you have:

classBreakStyle.BreakValueInclusion = BreakValueInclusion.ExcludeValue;


This Exclusion value applies to all the classBreaks of the  ClassBreakMarkerStyle so you may not want to implement this as this wiil modify the behavior of all of your ClassBreaks.


This seems like a bug so an internal ticket will be created to review further.



Hi Ryan, 
  
 Thanks for your inputs!   
  
 I think that there is another bug with the  MarkerClassBreak.DefaultMarkerStyle.Popup…  take a look at my razor code.  The [#…#] are not translated at run time.  I mean that the popup on a map display [#…#] and not the value. 
  
 jm 
  
  
  
 

 .MarkerOverlay(overlay =>
            {

                overlay.Name("MarkerOverlay")
                    .IsBaseOverlay(false)
                    .Columns(col => col.Add(new FeatureSourceColumn("LocationType", "INTEGER", 32)))
                        .ZoomLevelSet(zoomlevelSet =>
                        {
                            HtmlString _html1 = new HtmlString("<div><h2>Group: [#MANUFACTURERGROUP#]</h2> <h3>Manufacture: [#MANUFACTURER#]</h3></div>");
                            
                            MarkerClassBreak classBreak0 = new MarkerClassBreak(0);
                            
                            MarkerClassBreak classBreak1 = new MarkerClassBreak(1);
                            classBreak1.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage(@"/App_Themes/img/Places/High Detail/48x48/Places - High Detail Headquarters.png", 48, 48);
                            classBreak1.DefaultMarkerStyle.WebImage.ImageOffsetX = 0;
                            classBreak1.DefaultMarkerStyle.WebImage.ImageOffsetX = 0;
                            classBreak1.DefaultMarkerStyle.Popup.ContentHtml = _html1.ToHtmlString();
                            classBreak1.DefaultMarkerStyle.Popup.AutoSize = false;
                            classBreak1.DefaultMarkerStyle.Popup.IsVisible = true;
                            classBreak1.DefaultMarkerStyle.Popup.HasCloseButton = false;
                            classBreak1.DefaultMarkerStyle.Popup.Width = 400;
                            classBreak1.DefaultMarkerStyle.Popup.Height = 100;
                            
                            
                            MarkerClassBreak classBreak2 = new MarkerClassBreak(2);
                            classBreak2.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage(@"/App_Themes/img/Places/High Detail/32x32/Places - High Detail Office Building 1.png", 32, 32);
                            classBreak2.DefaultMarkerStyle.WebImage.ImageOffsetX = 0;
                            classBreak2.DefaultMarkerStyle.WebImage.ImageOffsetY = 0;
                            classBreak2.DefaultMarkerStyle.Popup.ContentHtml = _html1.ToHtmlString();
                            classBreak2.DefaultMarkerStyle.Popup.AutoSize = false;
                            classBreak2.DefaultMarkerStyle.Popup.IsVisible = false;
                            classBreak2.DefaultMarkerStyle.Popup.HasCloseButton = false;
                            classBreak2.DefaultMarkerStyle.Popup.Width = 400;
                            classBreak2.DefaultMarkerStyle.Popup.Height = 100;                           
                            
                            MarkerClassBreak classBreak3 = new MarkerClassBreak(3);
                            classBreak3.DefaultMarkerStyle.WebImage = new ThinkGeo.MapSuite.MvcEdition.WebImage(@"/App_Themes/img/Places/High Detail/24x24/Places - High Detail Industrial 2.png", 24, 24);
                            classBreak3.DefaultMarkerStyle.WebImage.ImageOffsetX = 0;
                            classBreak3.DefaultMarkerStyle.WebImage.ImageOffsetY = 0;

                            ClassBreakMarkerStyle classBreakStyle = new ClassBreakMarkerStyle("LocationType");
                            classBreakStyle.ClassBreaks.Add(classBreak0);
                            classBreakStyle.ClassBreaks.Add(classBreak1);
                            classBreakStyle.ClassBreaks.Add(classBreak2);
                            classBreakStyle.ClassBreaks.Add(classBreak3);
                            classBreakStyle.ColumnName = "LocationType";

                            zoomlevelSet.ZoomLevel01.CustomMarkerStyle = classBreakStyle;
                            zoomlevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
                        });

            })
 


Hi Jean-Marie,  
  
 I think this might be due to your Overlay not being aware of the MANUFACTURERGROUP or MANUFACTURER columns. Note that you have a .Columns collection for your .MarkerOverlay. This collection needs to contain all the FeatureSourceColumns that you need access to. For an example take a look at my code where you will see that when I am reading from the ShapeFileFeatureSource I add a FeatureSourceColumn to the .MarkerOverlay.Columns for each FeatureSourceColumn found in the FeatureSource.

Thanks Ryan! 
  
 I load the columns from the controller and I forgot about! 
  
 jm.

Ryan, 
  
 I have question about FDO on another post witihin this forum could you take a look at it? 
  
 thanks 
 jm

 Hello Jean-marie,


 
 If you are mentioned this one: gis.thinkgeo.com/Support/Discussion...fault.aspx
 
 I think Ryan have made an answer, please have a look at it, and don't hesitate to let us know if you have any questions.
 
 Regards,
 
 Gary

Hi Jean-Marie,  
  
 We modified the ClassBreakInclusion logic so that when set to .IncludeValue the BreakValue of your first ClassBreak will be ‘Included’ and thus ‘trigger’ that first class break. Please download the latest development build to try this out.

Hi Ryan, 
  
 Thanks!

Thanks for you feedback Jean, if you have any questions please let us know. 
  
 Regards, 
 Edgar