Class ZoomLevelFunction

All Implemented Interfaces:
Expression, Function, FunctionExpression, Factory

public class ZoomLevelFunction extends FunctionExpressionImpl
Function that takes a scale denominator and a srid and outputs the zoom level.

Note: EPSG:3857 is currently the only supported srid, and zoom levels are assumed to be at the equator.

Example:

 ff.function("zoomLevel",
               ff.function("env", ff.literal("wms_scale_denominator")),
               ff.literal("EPSG:3857")
            );
 
The above function would evaluate to the zoomLevel that corresponds to the current environment's wms_scale_denominator, for EPSG:3857.

Example 2:
 ff.function("zoomLevel",
               ff.literal(136494.693347),
               ff.literal("EPSG:3857")
            );
 
The above function would evaluate to a zoomLevel of 12.
  • Field Details

    • NAME

      public static final FunctionName NAME
    • MBSTYLE_ROOT_TILE_PIXELS_KEY

      public static final String MBSTYLE_ROOT_TILE_PIXELS_KEY
      Name of the system variable controlling ROOT_TILE_PIXELS
      See Also:
    • ROOT_TILE_PIXELS

      public static final int ROOT_TILE_PIXELS
      Number of pixels in the side of the root tile. Assumes 512 if not otherwise configured.
    • EPSG_3857_O_SCALE

      public static final double EPSG_3857_O_SCALE
      Scale denominator of the root tile. Changes based on the ROOT_TILE_PIXELS value.
  • Constructor Details

    • ZoomLevelFunction

      public ZoomLevelFunction()
  • Method Details