Skip to main content
A newer version of this page is available. .

MapItemsLayerBase.ExportToShp(String, ShpExportOptions) Method

Exports this vector layer data to the specified shapefile.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.2.dll

Declaration

public void ExportToShp(
    string filePath,
    ShpExportOptions options
)

Parameters

Name Type Description
filePath String

A String object specifying the file path used to save data.

options ShpExportOptions

A ShpExportOptions object specifying export options.

Example

This example shows how to export the map vector layer items to the .SVG, .KML, and .SHP file formats.

The following API members are used:

Member Description
MapItemsLayerBase.ExportToSvg Exports data from this vector layer to the specified stream using the defined parameters.
SvgExportOptions The options to be applied when exporting the vector layer to the SVG file format.
MapItemsLayerBase.ExportToKml Exports data from this vector layer to the specified stream using the KML file format.
MapItemsLayerBase.ExportToShp Exports this vector layer data to the specified shapefile.
ShpExportOptions The options to be applied when exporting the vector layer to a shapefile.
XtraSaveFileDialog A replacement for the standard WinForms SaveFileDialog. Supports theming by DevExpress Skins.
VectorItemsLayer layer { get { return mapControl.Layers[0] as VectorItemsLayer; } }
//...
private void exportButton_Click(object sender, EventArgs e) {
    XtraSaveFileDialog xtraSaveFileDialog = new XtraSaveFileDialog() {
        Title = "Export...",
        FileName = "Map",
        Filter = "SVG Image|*.svg|KML File|*.kml|Shapefile|*.shp"
    };
    xtraSaveFileDialog.ShowDialog();
    if(xtraSaveFileDialog.FileName != string.Empty) {
        switch(xtraSaveFileDialog.FilterIndex) {                    
            case 1:
                layer.ExportToSvg(xtraSaveFileDialog.FileName, 1, new SvgExportOptions() {
                    CoordinateSystem = new GeoMapCoordinateSystem(),
                    InitialMapSize = mapControl.Size
                });
                break;
            case 2:
                layer.ExportToKml(xtraSaveFileDialog.FileName);
                break;
            case 3:
                layer.ExportToShp(xtraSaveFileDialog.FileName, new ShpExportOptions {
                    ExportToDbf = true,
                    ShapeType = ShapeType.Polygon
                });
                break;
            default:
                break;
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ExportToShp(String, ShpExportOptions) 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.

See Also