Skip to main content

MapItemsLayerBase.ExportToSvg(String, Double, SvgExportOptions) Method

Exports data from this vector layer to the specified SVG file using the defined parameters.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v23.2.dll

NuGet Package: DevExpress.Win.Map

Declaration

public void ExportToSvg(
    string filePath,
    double scale,
    SvgExportOptions exportOptions
)

Parameters

Name Type Description
filePath String

The path of the file that is used to save vector items.

scale Double

The scale factor used to export map items to SVG.

exportOptions SvgExportOptions

The storage of values required for correct export.

Remarks

The export method requires several property values of the MapControl. If the layer is not added to the MapControl, the exportOptions parameter provides these values.

Note

Note that if this method is used, the parameters of exportOptions are always used instead of parameters of the Map Control.

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 dialog that allows a user to save a file. Supports 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;
        }
    }
}
See Also