It can be useful to filter certain objects from a layer and exclude them from visualization and other actions on the map, such as object selection or the display of tool tips. You may want to filter out objects to:

  • Focus on the most relevant data during analysis

  • Enhance rendering performance

  • Keep the map view clear

There are three ways to filter objects in a layer:

  • Set a scale range: to display objects, or labels, between a limited range of map scales only. For example, set a scale range to display runways at a scale of 1:100.000 and higher only. See the methods getScaleRange and setScaleRange of TLcdGXYLayer in the API reference for more information. For details on converting map scales to layer scales, see samples.common.gxy.GXYScaleSupport.

  • Write a generic filter: each object of the ILcdModel is passed to this filter. You can use any criterion to either include or exclude the object. For example, use a generic filter to display cities with more than 1.000.000 citizens only. OGC filtering is an advanced LuciadLightspeed implementation of this filter type. For more information, see OGC Filters in a LuciadLightspeed application.

  • Set a minimum object size: when users have zoomed out the map, small objects may no longer be relevant. For example, displaying runways at a map scale of 1:100.000.000 does not make much sense. TLcdGXYLayer.setMinimumObjectSizeForPainting allows you to set a size threshold in pixels for objects. Objects that are smaller than the given threshold are automatically excluded. You can disable this behavior by setting the threshold to 0. See the API reference for more information.