Class
MapSource

Abstract base class for all data sources that provide shapefile data to the MapShapeReader. Provides factory methods to create MapSource instances from various sources including embedded resources, files, streams, and URIs.

Definition

Namespace:Telerik.Maui.Controls.Map

Assembly:Telerik.Maui.Controls.dll

Syntax:

cs-api-definition
public abstract class MapSource : NotifyPropertyChangedBase, INotifyPropertyChanged

Inheritance: objectNotifyPropertyChangedBaseMapSource

Derived Classes: FileMapSourceStreamMapSource

Implements: INotifyPropertyChanged

Inherited Members NotifyPropertyChangedBase.OnPropertyChanged(string)NotifyPropertyChangedBase.UpdateValue<T>(ref T, T, string)NotifyPropertyChangedBase.UpdateValue<T>(ref T, T, Action<T>, string)NotifyPropertyChangedBase.PropertyChanged

Constructors

MapSource()

Declaration

cs-api-definition
protected MapSource()

Methods

FromFile(string)

Creates a MapSource from a file path on the local file system. Use this method to load shapefiles from the device's storage or application bundle.

Declaration

cs-api-definition
public static MapSource FromFile(string file)

Parameters

file

string

The full or relative path to the shapefile on the local file system.

Returns

MapSource

A MapSource that reads from the specified file.

FromResource(string, Assembly)

Creates a MapSource from an embedded resource within an assembly. This is the most common way to include shapefile data with your application.

Declaration

cs-api-definition
public static MapSource FromResource(string resource, Assembly sourceAssembly = null)

Parameters

resource

string

The full name of the embedded resource containing the shapefile (e.g., "MyApp.Data.world.shp").

sourceAssembly

Assembly

The assembly containing the embedded resource. If null, uses the calling assembly.

Returns

MapSource

A MapSource that reads from the specified embedded resource.

FromResource(string, Type)

Creates a MapSource from an embedded resource using a type to resolve the assembly. This is a convenience overload that automatically determines the assembly from the provided type.

Declaration

cs-api-definition
public static MapSource FromResource(string resource, Type resolvingType)

Parameters

resource

string

The full name of the embedded resource containing the shapefile.

resolvingType

Type

A type from the assembly containing the embedded resource.

Returns

MapSource

A MapSource that reads from the specified embedded resource.

FromStream(Stream)

Creates a MapSource from a Stream containing shapefile data. Use this method when you have shapefile data in memory or from a custom source.

Declaration

cs-api-definition
public static MapSource FromStream(Stream stream)

Parameters

stream

Stream

The stream containing the shapefile data. The stream should remain open until reading is complete.

Returns

MapSource

A MapSource that reads from the specified stream.

Operators

implicit operator MapSource(Stream)

Provides implicit conversion from a Stream to a MapSource. This allows direct assignment of streams to MapSource properties.

Declaration

cs-api-definition
public static implicit operator MapSource(Stream stream)

Parameters

stream

Stream

The stream to convert to a MapSource.

Returns

MapSource

A MapSource created from the stream, or null if the stream is null.

implicit operator MapSource(string)

Provides implicit conversion from a string file path to a MapSource. This allows direct assignment of file paths to MapSource properties.

Declaration

cs-api-definition
public static implicit operator MapSource(string source)

Parameters

source

string

The file path to convert to a MapSource.

Returns

MapSource

A MapSource created from the file path, or null if the string represents an absolute non-file URI.