Class Layer

java.lang.Object
dev.avelar.mapnik.Layer
All Implemented Interfaces:
AutoCloseable

public final class Layer extends Object implements AutoCloseable
A map layer. There are two kinds:
  • Method Details

    • create

      public static Layer create(String name)
      A new standalone layer in EPSG:4326.
    • create

      public static Layer create(String name, String srs)
      A new standalone layer. srs may be null for the default (WGS 84).
    • name

      public String name()
    • setName

      public Layer setName(String name)
    • srs

      public String srs()
      The projection of this layer's data.
    • setSrs

      public Layer setSrs(String srs)
    • styles

      public List<String> styles()
      Names of the styles this layer is drawn with, in order.
    • addStyle

      public Layer addStyle(String styleName)
    • isActive

      public boolean isActive()
      Whether the layer is drawn at all. On by default.
    • setActive

      public Layer setActive(boolean active)
    • minimumScaleDenominator

      public double minimumScaleDenominator()
    • setMinimumScaleDenominator

      public Layer setMinimumScaleDenominator(double v)
    • maximumScaleDenominator

      public double maximumScaleDenominator()
    • setMaximumScaleDenominator

      public Layer setMaximumScaleDenominator(double v)
    • isVisibleAt

      public boolean isVisibleAt(double scaleDenominator)
      True if the layer is active and scaleDenominator is inside its scale range.
    • opacity

      public double opacity()
    • setOpacity

      public Layer setOpacity(double opacity)
    • compOp

      public Optional<String> compOp()
      How this layer is blended onto what is below it, by the name used in styles, such as multiply, screen or src-over. Empty if never set.
    • setCompOp

      public Layer setCompOp(String name)
      Set the blend mode. Throws MapnikException for a name Mapnik does not know.
    • setCompOp

      public Layer setCompOp(BlendMode mode)
    • addChild

      public Layer addChild(Layer child)
      Add a copy of child under this layer, to group layers.
    • childCount

      public int childCount()
    • childCopy

      public Layer childCopy(int index)
      A copy of the child at index, which you own and should close. Changes to it do not affect this layer.
    • isQueryable

      public boolean isQueryable()
    • setQueryable

      public Layer setQueryable(boolean v)
    • clearsLabelCache

      public boolean clearsLabelCache()
    • setClearLabelCache

      public Layer setClearLabelCache(boolean v)
    • cachesFeatures

      public boolean cachesFeatures()
    • setCacheFeatures

      public Layer setCacheFeatures(boolean v)
    • groupBy

      public String groupBy()
      The column rendering is grouped by, or an empty string.
    • setGroupBy

      public Layer setGroupBy(String column)
    • bufferSize

      public Optional<Integer> bufferSize()
      Buffer around the layer's tiles in pixels, if set. Falls back to the map's buffer size.
    • setBufferSize

      public Layer setBufferSize(int size)
    • resetBufferSize

      public Layer resetBufferSize()
    • maximumExtent

      public Optional<Box2d> maximumExtent()
      Extent beyond which this layer is not drawn, if set.
    • setMaximumExtent

      public Layer setMaximumExtent(Box2d box)
    • resetMaximumExtent

      public Layer resetMaximumExtent()
    • setDatasource

      public Layer setDatasource(Datasource ds)
      Attach a datasource. The layer keeps its own reference, so you may close ds afterwards.
    • datasource

      public Optional<Datasource> datasource()
      A new handle onto the layer's datasource, which you should close, or empty if there is none.
    • envelope

      public Box2d envelope()
      The extent of the layer's data, in the layer's projection. Throws if there is no datasource.
    • close

      public void close()
      Frees a layer made with create(java.lang.String). Does nothing for a view onto a map's layer.
      Specified by:
      close in interface AutoCloseable