New to Telerik UI for .NET MAUIStart a free 30-day trial

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

Constructors

C#
protected MapSource()

Methods

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.

C#
public static MapSource FromFile(string file)
Parameters:filestring

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

Returns:

MapSource

A MapSource that reads from the specified file.

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

C#
public static MapSource FromResource(string resource, Assembly sourceAssembly = null)
Parameters:resourcestring

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

sourceAssemblyAssembly

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

Returns:

MapSource

A MapSource that reads from the specified embedded resource.

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.

C#
public static MapSource FromResource(string resource, Type resolvingType)
Parameters:resourcestring

The full name of the embedded resource containing the shapefile.

resolvingTypeType

A type from the assembly containing the embedded resource.

Returns:

MapSource

A MapSource that reads from the specified embedded resource.

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

C#
public static MapSource FromStream(Stream stream)
Parameters:streamStream

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

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

C#
public static implicit operator MapSource(Stream stream)
Parameters:streamStream

The stream to convert to a MapSource.

Returns:

MapSource

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

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

C#
public static implicit operator MapSource(string source)
Parameters:sourcestring

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.