Hi,
As shown in the attached screen shots (Screenshot_All.jpg ; screenShot_WithSelect.jpg) , I would be able to select certain features according to a variable. These features belong to the same layer.
Currently, as I use a layer mssqlfeature I use the "where clause"
But is there another method you recommend to have this kind of functionality …? using styles ? or …
Thanks a lot for your help.
Regards.
Steph.
ScreenShot_All.jpg (12 KB)
ScreenShot_WithSelect.jpg (10.8 KB)
Filter features on a layer
Hi Steph,
If the data source is from sql server, then I think using “where clause” is the best one as the clause will translate to sql statement and execute filtering feature on the sql server side.
But here is another query style if you want to try, it’s a new style named “FilterStyle”, here are some codes on how to use it.
ShapeFileFeatureLayer shpLayer = new ShapeFileFeatureLayer(@"…\App_Data\USStates.shp");
FilterStyle popluationFilterStyle = new FilterStyle();
popluationFilterStyle.Conditions.Add(new FilterCondition() { Expression = “> 15000000”, ColumnName = “POP1990” });
popluationFilterStyle.Styles.Add(AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, GeoColor.StandardColors.LightBlue)));
shpLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(houseHoldFilterStyle);
shpLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
But this style performance is still not good as “where clause”.
If any questions, please feel free to let us know.
Thanks,
Troy
Hi Troy,
And for inmemorylayer, it is appropriate to use filterstyle ?
Thanks.
Regards.
Steph.
Hi Steph,
Yes, This style is fit for all the FeatureLayer including InmemoryFeatureLayer.
Please let me know if you have any questions on using it.
Thanks,
Troy