Search Results for

    Show / Hide Table of Contents

    Class GridLayer

    A layer that renders a reference grid in the map's native coordinate system (CRS). Useful as a background when no tile layer is present — the grid gives visual feedback when panning or zooming because the lines scroll and spread with the map. No projection is performed; grid intervals are computed directly from Resolution and world units.

    Inheritance
    object
    BaseLayer
    GridLayer
    Implements
    ILayer
    IAnimatable
    INotifyPropertyChanged
    IDisposable
    Inherited Members
    BaseLayer.NextId()
    BaseLayer.PropertyChanged
    BaseLayer.DataChanged
    BaseLayer.Id
    BaseLayer.Tag
    BaseLayer.MinVisible
    BaseLayer.MaxVisible
    BaseLayer.Enabled
    BaseLayer.Name
    BaseLayer.Opacity
    BaseLayer.Busy
    BaseLayer.Style
    BaseLayer.Attribution
    BaseLayer.Resolutions
    BaseLayer.SortFeatures
    BaseLayer.CustomLayerRendererName
    BaseLayer.DataHasChanged()
    BaseLayer.ToString()
    BaseLayer.OnPropertyChanged(string)
    BaseLayer.OnDataChanged(DataChangedEventArgs)
    BaseLayer.Dispose(bool)
    BaseLayer.Dispose()
    BaseLayer.UpdateAnimations()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Mapsui.Layers
    Assembly: Mapsui.dll
    Syntax
    public class GridLayer : BaseLayer, ILayer, IAnimatable, INotifyPropertyChanged, IDisposable
    Remarks

    The grid covers the entire viewport at all zoom levels. Use MinVisible and MaxVisible to restrict the resolution range where the grid is visible.

    Constructors

    | Edit this page View Source

    GridLayer()

    Creates a grid layer with the default name "Grid".

    Declaration
    public GridLayer()
    | Edit this page View Source

    GridLayer(string)

    Creates a grid layer with the given name.

    Declaration
    public GridLayer(string name)
    Parameters
    Type Name Description
    string name

    Fields

    | Edit this page View Source

    LayerRendererName

    Name used to register the grid renderer with MapRenderer.RegisterLayerRenderer.

    Declaration
    public const string LayerRendererName = "grid-layer"
    Field Value
    Type Description
    string

    Properties

    | Edit this page View Source

    Extent

    Returns the envelope of all available data in the layer

    Declaration
    public override MRect? Extent { get; }
    Property Value
    Type Description
    MRect
    Overrides
    BaseLayer.Extent
    | Edit this page View Source

    LabelColor

    Color of the coordinate labels. Default: semi-transparent dark grey.

    Declaration
    public Color LabelColor { get; set; }
    Property Value
    Type Description
    Color
    | Edit this page View Source

    LabelFont

    Optional font to use for coordinate labels. When set, Size overrides LabelSize and FontSource allows loading a custom typeface. When null, the renderer falls back to LabelSize with the system default typeface.

    Declaration
    public Font? LabelFont { get; set; }
    Property Value
    Type Description
    Font
    | Edit this page View Source

    LabelSize

    Font size of the coordinate labels in screen pixels. Default: 12.

    Declaration
    public float LabelSize { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    LineColor

    Color of the grid lines. Default: semi-transparent grey.

    Declaration
    public Color LineColor { get; set; }
    Property Value
    Type Description
    Color
    | Edit this page View Source

    LineWidth

    Width of the grid lines in screen pixels. Default: 1.

    Declaration
    public float LineWidth { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    ShowCoordinateLabels

    Whether to draw coordinate labels alongside the grid lines. Default: false. Labels show raw world coordinates in the map's CRS (e.g. EPSG:3857 metres by default), not longitude/latitude. Keep this in mind when the map uses a projected coordinate system.

    Declaration
    public bool ShowCoordinateLabels { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    TargetLineCount

    Target number of grid lines to show across the wider viewport dimension. The actual count will vary because intervals snap to "nice" values (1, 2, 5 × 10^n). Default: 6.

    Declaration
    public int TargetLineCount { get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    GetFeatures(MRect?, double)

    Get all features in a given MRect for a given resolution

    Declaration
    public override IEnumerable<IFeature> GetFeatures(MRect? rect, double resolution)
    Parameters
    Type Name Description
    MRect rect
    double resolution

    Resolution of viewport

    Returns
    Type Description
    IEnumerable<IFeature>
    Overrides
    BaseLayer.GetFeatures(MRect, double)

    Implements

    ILayer
    IAnimatable
    INotifyPropertyChanged
    IDisposable

    Extension Methods

    LayerExtensions.WaitForLoadingAsync(ILayer)
    DisposableExtension.DisposeIfDisposable(object?)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX