alexa
Syncfusion
menu Syncfusion

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class MapSource

    Represents the map source that reads the shape source from the local file, URL, stream or embedded resource.

    Inheritance
    object
    MapSource
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Maui.Maps
    Assembly: Syncfusion.Maui.Maps.dll
    Syntax
    public class MapSource

    Constructors

    MapSource()

    Declaration
    public MapSource()

    Methods

    FromFile(string)

    Returns a new MapSource that reads from file.

    Declaration
    public static MapSource FromFile(string file)
    Parameters
    Type Name Description
    string file

    The file.

    Returns
    Type Description
    MapSource

    Returns file map source.

    FromStream(Stream)

    Returns a new MapSource that reads from json stream.

    Declaration
    public static MapSource FromStream(Stream jsonStream)
    Parameters
    Type Name Description
    Stream jsonStream

    The json stream.

    Returns
    Type Description
    MapSource

    Returns json stream map source.

    Examples
    • XAML
    • C#
    <map:SfMaps>
       <map:SfMaps.Layer>
          <map:MapShapeLayer x:Name="layer"/>
       </map:SfMaps.Layer>
    </map:SfMaps>
    // Shape path structure should be like SampleName.FolderName.FileName.Extension
    Assembly? assembly = IPlatformApplication.Current?.GetType().GetTypeInfo().Assembly;
    var jsonStream = assembly?.GetManifestResourceStream("MapDemo.ShapeFiles.world_map.json");
    this.layer.ShapesSource = MapSource.FromStream(jsonStream);

    FromStream(Stream, Stream)

    Returns a new MapSource that reads from shapefile stream.

    Declaration
    public static MapSource FromStream(Stream shapeStream, Stream dbfStream)
    Parameters
    Type Name Description
    Stream shapeStream

    The shapefile stream.

    Stream dbfStream

    The dbf stream.

    Returns
    Type Description
    MapSource

    Returns shape stream map source.

    Examples
    • XAML
    • C#
    <map:SfMaps>
       <map:SfMaps.Layer>
          <map:MapShapeLayer x:Name="layer" />
       </map:SfMaps.Layer>
    </map:SfMaps>
    // Shape path structure should be like SampleName.FolderName.FileName.Extension
    Assembly? assembly = IPlatformApplication.Current?.GetType().GetTypeInfo().Assembly;
    var shapeStream = assembly?.GetManifestResourceStream("MapDemo.ShapeFiles.world_map.shp");
    var dbfStream = assembly?.GetManifestResourceStream("MapDemo.ShapeFiles.world_map.dbf");
    this.layer.ShapesSource = MapSource.FromStream(shapeStream, dbfStream);

    FromUri(Uri)

    Returns a new MapSource that reads from uri.

    Declaration
    public static MapSource FromUri(Uri uri)
    Parameters
    Type Name Description
    Uri uri

    The shape source uri.

    Returns
    Type Description
    MapSource

    Returns uri map source.

    Examples
    • XAML
    • C#
    <map:SfMaps>
       <map:SfMaps.Layer>
          <map:MapShapeLayer x:Name="layer" 
                             ShapesSource="https://cdn.syncfusion.com/maps/map-data/world-map.json"/>
       </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    maps.Layer = layer;
    this.Content = maps;

    Operators

    implicit operator MapSource(Stream)

    Method to implicitly check the stream from the xaml.

    Declaration
    public static implicit operator MapSource(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The stream.

    Returns
    Type
    MapSource

    implicit operator MapSource(string)

    Method to implicitly check the string is Uri or file source from the xaml.

    Declaration
    public static implicit operator MapSource(string source)
    Parameters
    Type Name Description
    string source

    The source.

    Returns
    Type
    MapSource

    implicit operator MapSource(Uri)

    Method to implicitly check the string is Uri from the xaml.

    Declaration
    public static implicit operator MapSource(Uri uri)
    Parameters
    Type Name Description
    Uri uri

    The uri.

    Returns
    Type
    MapSource
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved