Back to Devexpress

ShapefileDataAdapter.LoadPrjFile(Uri) Method

windowsforms-devexpress-dot-xtramap-dot-shapefiledataadapter-dot-loadprjfile-x28-system-dot-uri-x29.md

latest5.3 KB
Original Source

ShapefileDataAdapter.LoadPrjFile(Uri) Method

SECURITY-RELATED CONSIDERATIONS

Loading coordinate system metadata from files passed as URLs to the LoadPrjFile method 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

Loads coordinate system metadata from the *.PRJ file.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public static SourceCoordinateSystem LoadPrjFile(
    Uri prjFileUri
)
vb
Public Shared Function LoadPrjFile(
    prjFileUri As Uri
) As SourceCoordinateSystem

Parameters

NameTypeDescription
prjFileUriUri

A Uri object that is the URI to the *.PRJ file.

|

Returns

TypeDescription
SourceCoordinateSystem

A SourceCoordinateSystem class descendant that contains the content of the *.PRJ file.

|

Remarks

Call the ShapefileDataAdapter.LoadPrjFromStream(Stream) method to load coordinate system metadata from the specified stream.

Refer to the Shapefile topic for more information about *.PRJ and shapefiles.

Example

csharp
data.Add(new MapData() {
    Name = "LoadPrjFile( ) calling loaded coordinate system",
    FileUri = new Uri(baseUri, "../../Shapefiles/Lambert/Belize.shp"),
    CoordinateSystem = ShapefileDataAdapter.LoadPrjFile(new Uri(
        baseUri,
        "../../Shapefiles/Lambert/Projection.prj"))
});
vb
data.Add(New MapData() With {.Name = "LoadPrjFile( ) calling loaded coordinate system", .FileUri = New Uri(baseUri, "../../Shapefiles/Lambert/Belize.shp"), .CoordinateSystem = ShapefileDataAdapter.LoadPrjFile(New Uri(baseUri, "../../Shapefiles/Lambert/Projection.prj"))})

The following code snippets (auto-collected from DevExpress Examples) contain references to the LoadPrjFile(Uri) method.

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-convert-a-cartesian-data-shapefile-to-geo-coordinates/CS/MapSample/Form1.cs#L81

csharp
{
    shapefileDataAdapter1.SourceCoordinateSystem= ShapefileDataAdapter.LoadPrjFile(new Uri(dialog.FileName));
    btnSave.Enabled = true;

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

csharp
Adapter.FileUri = new Uri(baseUri, geoMapCartesianDataShpFile);
Adapter.SourceCoordinateSystem = ShapefileDataAdapter.LoadPrjFile(new Uri(baseUri, geoMapCartesianDataPrjFile));

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

vb
If dialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
    shapefileDataAdapter1.SourceCoordinateSystem= ShapefileDataAdapter.LoadPrjFile(New Uri(dialog.FileName))
    btnSave.Enabled = True

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

vb
Adapter.FileUri = New Uri(baseUri, geoMapCartesianDataShpFile)
Adapter.SourceCoordinateSystem = ShapefileDataAdapter.LoadPrjFile(New Uri(baseUri, geoMapCartesianDataPrjFile))
mapControl.CoordinateSystem = New GeoMapCoordinateSystem()

See Also

ShapefileDataAdapter Class

ShapefileDataAdapter Members

DevExpress.XtraMap Namespace