SaveAs

Saves the layer changes to a file with a specified name. Before saving, the layer can be filtered based on attribute and area filters. For security reasons the file is saved to a predefined “Skyline\TerraExplorer” folder in the “Application Data” space of the current user. The full path of the saved file is provided in the method’s return value. You can also use %APPDATA% in Windows Explorer to locate the path on your computer.

Note:    If the folder contains a file by the same name, the existing file is overwritten without a prompt.

Note:    The Application Data folder path changes between different users and different Windows operating systems. To find the path used by your client, look at the %APPDATA% environment variable.

 

JavaScript

 

SaveAs(

       FileName,

       AttributeFilter,

       AreaFilter)

 

C#

 

string SaveAs(

       string FileName,

       string AttributeFilter,

       IGeometry AreaFilter)

 

C++

 

HRESULT SaveAs(

       BSTR FileName,

       BSTR AttributeFilter,

       IGeometry* AreaFilter,

       BSTR* OutFilePath)

Parameters

FileName

The file name if saving to a shapefile or the connection string if saving to a GeoPackage, GeoDatabase, PDF or SQLite file. If the format is not specified, a shapefile file extension (.shp) is added to the file name automatically.
Note:            A file name with a full path cannot be used here.

·          When saving as a shapefile, the connection string must include the following parameters:

“FileName=NameOfShapeFile.shp;TEPlugName=OGR”

·          When saving as an Excel file, the connection string must include the following parameters:

“FileName=NameOfExcelFile.xlsx;TEPlugName=OGR”

Note:    Only point layers can be saved to Microsoft Excel.

·          When saving as an SQLite file, the connection string must include the following parameters:

“FileName=NameofSQLiteFile.sqlite;TEPlugName=OGR;LayerName=newlayername”

·          When saving as a GeoPackage, the connection string must include the following parameters:

“FileName=NameOfGeoPackageFile.gpkg;TEPlugName=OGR;LayerName=newlayername”

·          When saving as a GeoDatabase, the connection string must include the following parameters:

“FileName=NameOfGeoDatabaseFile.gdb;TEPlugName=OGR”;LayerName=newlayername”

·          When saving as a Geospatial PDF, the connection string must include the following parameters:

“FileName=NameOfGeospatialPDFFile.pdf;TEPlugName=OGR;LayerName=newlayername”

 

AttributeFilter

Any valid SQL WHERE clause that filters the layer’s features, thereby designating which of the layer’s features should be saved. If this parameter is set to “Selected Features”, all currently selected features are saved.

AreaFilter

An IGeometry representing the polygon or multipolygon that designates which part of the layer should be saved (only layer features that are spatially related to the polygon/ multipolygon will be saved).

Note:    In Javascript, if you do not want to use an area filter, you can call ICreator80. GeometryCreator.CreatePolygonGeometry(null)) to create a null IGeometry object.

Return Value

OutFilePath

The full path of the layer file being created.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.