com.supermap.data
Class DataConversion
- java.lang.Object
-
- com.supermap.data.DataConversion
-
public class DataConversion extends java.lang.Object
The data conversion class.
Provide data importing and exporting function. It can import the SHP, MIF, DWG, DXF, tif/tiff, KML, KMZ, GPX data to datasource in mobile to display and edit, also can export data from mobile as SHP, MIF, DWG, DXF, tif/tiff, KML, KMZ, GPX data, which is used to data interaction in server or other ends.
-
-
Constructor Summary
Constructors Constructor and Description DataConversion()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static boolean
exportDWG(java.lang.String filepath, Dataset dataset)
export specified dataset as dwg filestatic boolean
exportDXF(java.lang.String filepath, Dataset dataset)
export specified dataset as dxf filestatic boolean
exportGPX(java.lang.String filepath, DatasetVector dataset)
export GPX file, if the file is existed, then failstatic boolean
exportKML(java.lang.String filepath, Dataset dataset)
export kml file KML only support to export as vector dataset the projection dataset must be geographic coordinate WGC-1984static boolean
exportKMZ(java.lang.String filepath, Dataset dataset)
export kmz file KMZ only support to export as vector dataset the projection dataset must be geographic coordinate WGC-1984static boolean
exportMIF(java.lang.String filepath, Dataset dataset)
Export the MIF file.static boolean
exportSHP(java.lang.String filepath, Dataset dataset)
Export the SHP file.static boolean
exportTIF(java.lang.String filepath, Dataset dataset)
export dataset as tif/tiff image data file.static boolean
importDWG(ImportSettingDWG setting)
import DWG data according to import parametersstatic boolean
importDWG(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite)
import dwg file into datasource, and save as CAD datasetstatic boolean
importDWG(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite, boolean importAsCAD)
import dwg file into datasource, and save as CAD composite dataset or multiple simple datasetstatic boolean
importDXF(ImportSettingDXF setting)
import DXF data according to imported parametersstatic boolean
importDXF(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite)
import dxf file into datasource, and save as CAD datasetstatic boolean
importDXF(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite, boolean importAsCAD)
import dxf file into datasource, and save as CAD composite dataset or multiple simple datasetstatic boolean
importGPX(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName)
import GPX filestatic boolean
importIMG(ImportSettingIMG setting)
import IMG data according to IMG imported parameters.Image does not support single band 8 bit.static boolean
importIMG(java.lang.String filepath, Datasource datasource)
import IMG image into datasource as multiband.Image does not support single band 8 bit.static boolean
importIMG(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName)
import IMG image into datasource.Image does not support single band 8 bit.static boolean
importKML(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName, boolean importAsCAD)
import kml filestatic boolean
importKMZ(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName, boolean importAsCAD)
import kmz filestatic boolean
importMIF(java.lang.String filepath, Datasource datasource)
Import the MIF file.static boolean
importSHP(java.lang.String filepath, Datasource datasource)
Import the SHP file.static boolean
importTIF(ImportSettingTIF setting)
import TIF data according to import parametersstatic boolean
importTIF(java.lang.String filepath, Datasource datasource)
import tif/tiff image data file into datasource, and save as image datasetstatic boolean
importTIF(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName, boolean bImportingAsGrid)
import tif image into datasource, and it could be set that whether save as raster datasetstatic void
setConvertCharset(Charset charset)
Sets the imported or exported file the original character set type.static void
setImportEmptyDataset(boolean bImportEmptyDataset)
Sets whether it is null dataset. the default is not imported, if the imported data is null, return false when import.
-
-
-
Method Detail
-
importSHP
public static boolean importSHP(java.lang.String filepath, Datasource datasource) throws java.lang.Exception
Import the SHP file.- Parameters:
filepath
- file absolute path, include file name and file type.datasource
- target datasource.- Returns:
- true if it is imported successfully; false otherwise.
- Throws:
java.lang.Exception
- When the parameter is error, throw an IllegalArgumentException; For example, the specified file doesn't exist.
-
importMIF
public static boolean importMIF(java.lang.String filepath, Datasource datasource) throws java.lang.Exception
Import the MIF file.- Parameters:
filepath
- file absolute path, include file name and file type.datasource
- target datasource.- Returns:
- true if it is imported successfully; false otherwise.
- Throws:
java.lang.Exception
- When the parameter is error, throw an IllegalArgumentException; For example, the specified file doesn't exist.
-
exportSHP
public static boolean exportSHP(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
Export the SHP file.- Parameters:
filepath
- export file absolute path, include file name and file type.dataset
- Used in the dataset to be exported.- Returns:
- true if it is exported successfully; false otherwise.
- Throws:
java.lang.Exception
- When the parameter is error, throw an IllegalArgumentException; For example, the specified dictionary does not exist.
-
exportMIF
public static boolean exportMIF(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
Export the MIF file.- Parameters:
filepath
- export file absolute path, include file name and file type.dataset
- Used in the dataset to be exported.- Returns:
- true if it is exported successfully; false otherwise.
- Throws:
java.lang.Exception
- When the parameter is error, throw an IllegalArgumentException; For example, the specified dictionary does not exist.
-
setConvertCharset
public static void setConvertCharset(Charset charset)
Sets the imported or exported file the original character set type.- Parameters:
charset
- The character set. Default is GB18030.
-
importTIF
public static boolean importTIF(java.lang.String filepath, Datasource datasource) throws java.lang.Exception
import tif/tiff image data file into datasource, and save as image dataset- Parameters:
filepath
- tif/tiff image file absolute path, include file name and file type.datasource
- datasource, used to stored imported result dataset- Returns:
- True, if successful; Otherwise false.
- Throws:
java.lang.Exception
- throws Exception when the parameter is exception
-
exportTIF
public static boolean exportTIF(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
export dataset as tif/tiff image data file.- Parameters:
filepath
- specified export path of tif/tiff file, this path is absolute path, and include file name and file typedataset
- image dataset to be exported- Returns:
- True, if export successfully; Otherwise false.
- Throws:
java.lang.Exception
- the exported file must be tif/tiff type, otherwise throws exception
-
importDWG
public static boolean importDWG(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite) throws java.lang.Exception
import dwg file into datasource, and save as CAD dataset- Parameters:
filepath
- dwg file absolute path, include file name and file type.datasource
- target datasource.inverseBlackWhite
- whether inverse black and white- Returns:
- True, if import successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
exportDWG
public static boolean exportDWG(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
export specified dataset as dwg file- Parameters:
filepath
- export file absolute path, include file name and file type.dataset
- source dataset- Returns:
- True, if export successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importDXF
public static boolean importDXF(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite) throws java.lang.Exception
import dxf file into datasource, and save as CAD dataset- Parameters:
filepath
- dxf file absolute path, include file name and file type.datasource
- target datasource.inverseBlackWhite
- whether inverse black and white- Returns:
- True, if import successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
exportDXF
public static boolean exportDXF(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
export specified dataset as dxf file- Parameters:
filepath
- export file absolute path, include file name and file type.dataset
- source dataset- Returns:
- True, if export successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importDXF
public static boolean importDXF(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite, boolean importAsCAD) throws java.lang.Exception
import dxf file into datasource, and save as CAD composite dataset or multiple simple dataset- Parameters:
filepath
- dxf file absolute path, include file name and file type.datasource
- target datasource.inverseBlackWhite
- whether inverse black and whiteimportAsCAD
- true means that save as one CAD composite dataset, and false means that save as multiple simple dataset- Returns:
- True, if import successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importDWG
public static boolean importDWG(java.lang.String filepath, Datasource datasource, boolean inverseBlackWhite, boolean importAsCAD) throws java.lang.Exception
import dwg file into datasource, and save as CAD composite dataset or multiple simple dataset- Parameters:
filepath
- dwg file absolute path, include file name and file type.datasource
- target datasource.inverseBlackWhite
- whether inverse black and whiteimportAsCAD
- true means that save as one CAD composite dataset, and false means that save as multiple simple dataset- Returns:
- True, if import successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importKML
public static boolean importKML(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName, boolean importAsCAD) throws java.lang.Exception
import kml file- Parameters:
filepath
- import file path namedatasource
- target datasource.targetDatasetName
- target dataset nameimportAsCAD
- whether import as composite datset, and the default is that import as composite datset- Returns:
- True, if import successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
exportKML
public static boolean exportKML(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
export kml file KML only support to export as vector dataset the projection dataset must be geographic coordinate WGC-1984
- Parameters:
filepath
- export file path namedataset
- target dataset- Returns:
- True, if export successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importKMZ
public static boolean importKMZ(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName, boolean importAsCAD) throws java.lang.Exception
import kmz file- Parameters:
filepath
- import file path namedatasource
- target datasource.targetDatasetName
- target dataset nameimportAsCAD
- whether import as composite datset, and the default is that import as composite datset- Returns:
- True, if import successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
exportKMZ
public static boolean exportKMZ(java.lang.String filepath, Dataset dataset) throws java.lang.Exception
export kmz file KMZ only support to export as vector dataset the projection dataset must be geographic coordinate WGC-1984
- Parameters:
filepath
- export file path namedataset
- target dataset- Returns:
- True, if export successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importTIF
public static boolean importTIF(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName, boolean bImportingAsGrid) throws java.lang.Exception
import tif image into datasource, and it could be set that whether save as raster dataset- Parameters:
filepath
- tif data file pathdatasource
- target datasource.targetDatasetName
- target dataset namebImportingAsGrid
- whether import as raster dataset, false means import image dataset- Returns:
- True, if successful; Otherwise false.
- Throws:
java.lang.Exception
- parameter in wrong, and file type is not correct, then, throws exception
-
importGPX
public static boolean importGPX(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName) throws java.io.IOException
import GPX file- Parameters:
filepath
- import file path namedatasource
- target datasource.targetDatasetName
- target dataset name- Returns:
- True, if successful; Otherwise false.
- Throws:
java.io.IOException
- parameter of null indicator is exceptino etc.
-
exportGPX
public static boolean exportGPX(java.lang.String filepath, DatasetVector dataset) throws java.lang.Exception
export GPX file, if the file is existed, then fail- Parameters:
filepath
- GPX only support to export as vector datasetdataset
- the projection dataset must be geographic coordinate WGC-1984- Returns:
- True, if export successfully; Otherwise false.
- Throws:
java.lang.Exception
- parameter of null indicator is exceptino etc.
-
importDXF
public static boolean importDXF(ImportSettingDXF setting) throws java.lang.Exception
import DXF data according to imported parameters- Parameters:
setting
- imported parameters- Returns:
- whether import successfully
- Throws:
java.lang.Exception
- parameter of null indicator is exceptino etc.
-
importDWG
public static boolean importDWG(ImportSettingDWG setting) throws java.lang.Exception
import DWG data according to import parameters- Parameters:
setting
- imported parameters- Returns:
- whether import successfully
- Throws:
java.lang.Exception
- parameter of null indicator is exceptino etc.
-
importTIF
public static boolean importTIF(ImportSettingTIF setting)
import TIF data according to import parameters- Parameters:
setting
- imported parameters- Returns:
- whether import successfully
-
importIMG
public static boolean importIMG(java.lang.String filepath, Datasource datasource) throws java.lang.Exception
import IMG image into datasource as multiband.Image does not support single band 8 bit.- Parameters:
filepath
- IMG data file pathdatasource
- target datasource.- Returns:
- whether import successfully
- Throws:
java.lang.Exception
- parameter is exception
-
importIMG
public static boolean importIMG(java.lang.String filepath, Datasource datasource, java.lang.String targetDatasetName) throws java.lang.Exception
import IMG image into datasource.Image does not support single band 8 bit.- Parameters:
filepath
- IMG data file pathdatasource
- target datasource.targetDatasetName
- target dataset name- Returns:
- whether import successfully
- Throws:
java.lang.Exception
- parameter is exception
-
importIMG
public static boolean importIMG(ImportSettingIMG setting)
import IMG data according to IMG imported parameters.Image does not support single band 8 bit.- Parameters:
setting
- IMG imported parameters- Returns:
- whether import successfully
-
setImportEmptyDataset
public static void setImportEmptyDataset(boolean bImportEmptyDataset)
Sets whether it is null dataset. the default is not imported, if the imported data is null, return false when import. Currently, only supported shp file.- Parameters:
bImportEmptyDataset
- whether import null dataset, true means import, false means do not import
-
-