Back to Devexpress

ShapefileDataAdapter.FileUri Property

windowsforms-devexpress-dot-xtramap-dot-shapefiledataadapter.md

latest6.2 KB
Original Source

ShapefileDataAdapter.FileUri Property

SECURITY-RELATED CONSIDERATIONS

Downloading map data passed through URLs specified by the FileUri property may create security issues. Review the following help topic and learn how to spot, analyze, and prohibit unwanted download requests:

Suppress Control Requests to Download Data from External URLs

Gets or sets an Uri that defines the location of a shapefile.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(null)]
public Uri FileUri { get; set; }
vb
<DefaultValue(Nothing)>
Public Property FileUri As Uri

Property Value

TypeDefaultDescription
Urinull

A Uri object that contains a shapefile Uri.

|

Example

To load shape data from a shapefile do the following.

View Example

csharp
// Create data for the MapLayer.
    MapLayer.Data = CreateData();
private MapDataAdapterBase CreateData() {
    Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location);

    // Create an adapter to load data from shapefile.
    ShapefileDataAdapter adapter = new ShapefileDataAdapter() {
        FileUri = new Uri(baseUri, filename)
    };

    return adapter;
}
vb
' Create data for the MapLayer.
    MapLayer.Data = CreateData()
Private Function CreateData() As MapDataAdapterBase
    Dim baseUri As New Uri(System.Reflection.Assembly.GetEntryAssembly().Location)

    ' Create an adapter to load data from shapefile.
    Dim adapter As New ShapefileDataAdapter() With {.FileUri = New Uri(baseUri, filename)}

    Return adapter
End Function

The following code snippets (auto-collected from DevExpress Examples) contain references to the FileUri property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-map-customize-coordinate-systems-of-a-map/CS/CoordinateSystems/Form1.cs#L29

csharp
Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location);
Adapter.FileUri = new Uri(baseUri, geoMapGeoDataFile);
Adapter.SourceCoordinateSystem = new GeoSourceCoordinateSystem();

winforms-map-convert-a-cartesian-data-shapefile-to-geo-coordinates/CS/MapSample/Form1.cs#L49

csharp
{
    shapefileDataAdapter1.FileUri = new Uri(dialog.FileName);
    string projectionPath = dialog.FileName.Substring(0, dialog.FileName.Length-3) + "prj";

winforms-map-load-cartesian-data-to-a-map-control-with-a-coordinate-converter/CS/BuildInCoordinateConverters/Form1.cs#L94

csharp
Uri fileUri = new Uri(baseUri, data.Filepath);
adapter.FileUri = fileUri;
adapter.SourceCoordinateSystem = data.CoordinateSystem;

winforms-map-customize-coordinate-systems-of-a-map/VB/CoordinateSystems/Form1.vb#L34

vb
Dim baseUri As Uri = New Uri(Reflection.Assembly.GetEntryAssembly().Location)
Adapter.FileUri = New Uri(baseUri, geoMapGeoDataFile)
Adapter.SourceCoordinateSystem = New GeoSourceCoordinateSystem()

winforms-map-convert-a-cartesian-data-shapefile-to-geo-coordinates/VB/MapSample/Form1.vb#L43

vb
If dialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
    shapefileDataAdapter1.FileUri = New Uri(dialog.FileName)
    Dim projectionPath As String = dialog.FileName.Substring(0, dialog.FileName.Length-3) & "prj"

winforms-map-load-cartesian-data-to-a-map-control-with-a-coordinate-converter/VB/BuildInCoordinateConverters/Form1.vb#L47

vb
Dim fileUri As Uri = New Uri(baseUri, data.Filepath)
adapter.FileUri = fileUri
adapter.SourceCoordinateSystem = data.CoordinateSystem

See Also

ShapefileDataAdapter Class

ShapefileDataAdapter Members

DevExpress.XtraMap Namespace