ogr2ogr function can be used to convert simple features data between file formats. It can also perform various operations during the process, such as spatial or attribute selection, reducing the set of attributes, setting the output coordinate system or even reprojecting the features during translation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataset |
TypeDefs.Dataset
|
Dataset to be converted. |
|
options |
Array
|
<optional> |
Options (https://gdal.org/programs/ogr2ogr.html#description) |
outputName |
string
|
<optional> |
Destination file name without extension. |
Example
const Gdal = await initGdalJs();
const dataset = (await Gdal.open('data.mbtiles')).datasets[0];
const options = [
'-f', 'GeoJSON',
'-t_srs', 'EPSG:4326'
];
const filePath = await Gdal.ogr2ogr(dataset, options);