or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

ai-ml.mddata-conversion.mddata-export.mdearth-engine.mdindex.mdinteractive-mapping.mdvisualization.mdwidgets-tools.md

data-export.mddocs/

0

# Data Export and Processing

1

2

Comprehensive data export capabilities for Earth Engine assets to various formats and storage destinations including Google Drive, Cloud Storage, and local files. Provides extensive functionality for processing Earth Engine computations and exporting results.

3

4

## Capabilities

5

6

### Image Export

7

8

Export Earth Engine images to various destinations with customizable parameters for resolution, region, and format.

9

10

```python { .api }

11

def ee_export_image(

12

ee_object,

13

filename,

14

scale=None,

15

crs=None,

16

crs_transform=None,

17

region=None,

18

dimensions=None,

19

file_per_band=False,

20

format="ZIPPED_GEO_TIFF",

21

unzip=True,

22

unmask_value=None,

23

timeout=300,

24

proxies=None,

25

verbose=True

26

):

27

"""

28

Exports an ee.Image as a GeoTIFF.

29

30

Args:

31

ee_object: The ee.Image to download

32

filename (str): Output filename for the exported image

33

scale (float, optional): A default scale to use for any bands that do not specify one

34

crs (str, optional): A default CRS string to use for any bands that do not explicitly specify one

35

crs_transform (list, optional): A default affine transform to use for any bands that do not specify one

36

region: A polygon specifying a region to download

37

dimensions (list, optional): An optional array of two integers defining the width and height to which the band is cropped

38

file_per_band (bool, optional): Whether to produce a different GeoTIFF per band. Defaults to False

39

format (str, optional): One of "ZIPPED_GEO_TIFF" (default), "GEO_TIFF", "NPY"

40

unzip (bool, optional): Whether to unzip the downloaded file. Defaults to True

41

unmask_value (float, optional): The value to use for pixels that are masked in the input image

42

timeout (int, optional): The timeout in seconds for the request. Defaults to 300

43

proxies (dict, optional): A dictionary of proxy servers to use. Defaults to None

44

verbose (bool, optional): Whether to print out descriptive text. Defaults to True

45

"""

46

47

def ee_export_image_to_drive(

48

image,

49

description="myExportImageTask",

50

folder: str = None,

51

fileNamePrefix: str = None,

52

dimensions: str = None,

53

region: ee.Geometry = None,

54

scale: float = None,

55

crs: str = None,

56

crsTransform: List[float] = None,

57

maxPixels: int = 1e13,

58

shardSize: int = None,

59

fileDimensions: List[int] = None,

60

skipEmptyTiles: bool = None,

61

fileFormat: str = None,

62

formatOptions: Dict = None,

63

**kwargs

64

) -> ee.batch.Task:

65

"""

66

Export Earth Engine image to Google Drive.

67

68

Args:

69

ee_object: Earth Engine Image to export

70

description: Task description

71

folder: Drive folder name

72

fileNamePrefix: Output file name prefix

73

dimensions: Output dimensions

74

region: Export region

75

scale: Export resolution in meters

76

crs: Coordinate reference system

77

crsTransform: Coordinate transform matrix

78

maxPixels: Maximum pixels to export

79

shardSize: Shard size for large exports

80

fileDimensions: File dimensions for tiled exports

81

skipEmptyTiles: Skip empty tiles

82

fileFormat: Output format (GeoTIFF, TFRecord)

83

formatOptions: Format-specific options

84

**kwargs: Additional parameters

85

86

Returns:

87

Export task object

88

"""

89

90

def ee_export_image_to_asset(

91

ee_object,

92

description: str,

93

assetId: str,

94

pyramidingPolicy: Dict = None,

95

dimensions: str = None,

96

region: ee.Geometry = None,

97

scale: float = None,

98

crs: str = None,

99

crsTransform: List[float] = None,

100

maxPixels: int = 1e13,

101

**kwargs

102

) -> ee.batch.Task:

103

"""

104

Export Earth Engine image to Earth Engine asset.

105

106

Args:

107

ee_object: Earth Engine Image to export

108

description: Task description

109

assetId: Asset ID for output

110

pyramidingPolicy: Pyramiding policy for bands

111

dimensions: Output dimensions

112

region: Export region

113

scale: Export resolution in meters

114

crs: Coordinate reference system

115

crsTransform: Coordinate transform matrix

116

maxPixels: Maximum pixels to export

117

**kwargs: Additional parameters

118

119

Returns:

120

Export task object

121

"""

122

123

def ee_export_image_to_cloud_storage(

124

ee_object,

125

description: str,

126

bucket: str,

127

fileNamePrefix: str = None,

128

dimensions: str = None,

129

region: ee.Geometry = None,

130

scale: float = None,

131

crs: str = None,

132

crsTransform: List[float] = None,

133

maxPixels: int = 1e13,

134

shardSize: int = None,

135

fileDimensions: List[int] = None,

136

skipEmptyTiles: bool = None,

137

fileFormat: str = None,

138

formatOptions: Dict = None,

139

**kwargs

140

) -> ee.batch.Task:

141

"""

142

Export Earth Engine image to Google Cloud Storage.

143

144

Args:

145

ee_object: Earth Engine Image to export

146

description: Task description

147

bucket: GCS bucket name

148

fileNamePrefix: Output file name prefix

149

dimensions: Output dimensions

150

region: Export region

151

scale: Export resolution in meters

152

crs: Coordinate reference system

153

crsTransform: Coordinate transform matrix

154

maxPixels: Maximum pixels to export

155

shardSize: Shard size for large exports

156

fileDimensions: File dimensions for tiled exports

157

skipEmptyTiles: Skip empty tiles

158

fileFormat: Output format

159

formatOptions: Format-specific options

160

**kwargs: Additional parameters

161

162

Returns:

163

Export task object

164

"""

165

```

166

167

### Image Collection Export

168

169

Export Earth Engine image collections with options for batch processing and various output formats.

170

171

```python { .api }

172

def ee_export_image_collection(

173

ee_object: ee.ImageCollection,

174

out_dir: str,

175

scale: float = None,

176

region: ee.Geometry = None,

177

file_per_band: bool = False,

178

**kwargs

179

) -> None:

180

"""

181

Export Earth Engine image collection to local directory.

182

183

Args:

184

ee_object: Earth Engine ImageCollection to export

185

out_dir: Output directory

186

scale: Export resolution in meters

187

region: Export region geometry

188

file_per_band: Export each band as separate file

189

**kwargs: Additional export parameters

190

"""

191

192

def ee_export_image_collection_to_drive(

193

ee_object: ee.ImageCollection,

194

folder: str,

195

scale: float = None,

196

region: ee.Geometry = None,

197

fileFormat: str = "GeoTIFF",

198

**kwargs

199

) -> List[ee.batch.Task]:

200

"""

201

Export Earth Engine image collection to Google Drive.

202

203

Args:

204

ee_object: Earth Engine ImageCollection to export

205

folder: Drive folder name

206

scale: Export resolution in meters

207

region: Export region

208

fileFormat: Output format

209

**kwargs: Additional parameters

210

211

Returns:

212

List of export task objects

213

"""

214

215

def ee_export_image_collection_to_asset(

216

ee_object: ee.ImageCollection,

217

assetFolder: str,

218

scale: float = None,

219

region: ee.Geometry = None,

220

**kwargs

221

) -> List[ee.batch.Task]:

222

"""

223

Export Earth Engine image collection to Earth Engine assets.

224

225

Args:

226

ee_object: Earth Engine ImageCollection to export

227

assetFolder: Asset folder path

228

scale: Export resolution in meters

229

region: Export region

230

**kwargs: Additional parameters

231

232

Returns:

233

List of export task objects

234

"""

235

236

def ee_export_image_collection_to_cloud_storage(

237

ee_object: ee.ImageCollection,

238

bucket: str,

239

scale: float = None,

240

region: ee.Geometry = None,

241

fileFormat: str = "GeoTIFF",

242

**kwargs

243

) -> List[ee.batch.Task]:

244

"""

245

Export Earth Engine image collection to Google Cloud Storage.

246

247

Args:

248

ee_object: Earth Engine ImageCollection to export

249

bucket: GCS bucket name

250

scale: Export resolution in meters

251

region: Export region

252

fileFormat: Output format

253

**kwargs: Additional parameters

254

255

Returns:

256

List of export task objects

257

"""

258

```

259

260

### Vector Data Export

261

262

Export Earth Engine feature collections and vector data to various formats and destinations.

263

264

```python { .api }

265

def ee_export_vector(

266

ee_object: ee.FeatureCollection,

267

filename: str,

268

**kwargs

269

) -> None:

270

"""

271

Export Earth Engine feature collection to local file.

272

273

Args:

274

ee_object: Earth Engine FeatureCollection to export

275

filename: Output filename

276

**kwargs: Additional export parameters

277

"""

278

279

def ee_export_vector_to_drive(

280

collection: ee.FeatureCollection,

281

description: str,

282

folder: str = None,

283

fileNamePrefix: str = None,

284

fileFormat: str = None,

285

selectors: List[str] = None,

286

maxVertices: int = None,

287

**kwargs

288

) -> ee.batch.Task:

289

"""

290

Export Earth Engine feature collection to Google Drive.

291

292

Args:

293

collection: Earth Engine FeatureCollection to export

294

description: Task description

295

folder: Drive folder name

296

fileNamePrefix: Output file name prefix

297

fileFormat: Output format (SHP, GeoJSON, KML, KMZ, CSV)

298

selectors: Property names to include

299

maxVertices: Maximum vertices per feature

300

**kwargs: Additional parameters

301

302

Returns:

303

Export task object

304

"""

305

306

def ee_export_vector_to_asset(

307

collection: ee.FeatureCollection,

308

description: str,

309

assetId: str,

310

**kwargs

311

) -> ee.batch.Task:

312

"""

313

Export Earth Engine feature collection to Earth Engine asset.

314

315

Args:

316

collection: Earth Engine FeatureCollection to export

317

description: Task description

318

assetId: Asset ID for output

319

**kwargs: Additional parameters

320

321

Returns:

322

Export task object

323

"""

324

325

def ee_export_vector_to_cloud_storage(

326

collection: ee.FeatureCollection,

327

description: str,

328

bucket: str,

329

fileNamePrefix: str = None,

330

fileFormat: str = None,

331

selectors: List[str] = None,

332

maxVertices: int = None,

333

**kwargs

334

) -> ee.batch.Task:

335

"""

336

Export Earth Engine feature collection to Google Cloud Storage.

337

338

Args:

339

collection: Earth Engine FeatureCollection to export

340

description: Task description

341

bucket: GCS bucket name

342

fileNamePrefix: Output file name prefix

343

fileFormat: Output format

344

selectors: Property names to include

345

maxVertices: Maximum vertices per feature

346

**kwargs: Additional parameters

347

348

Returns:

349

Export task object

350

"""

351

352

def ee_export_geojson(

353

ee_object,

354

filename: str = None,

355

**kwargs

356

) -> Union[Dict, None]:

357

"""

358

Export Earth Engine object as GeoJSON.

359

360

Args:

361

ee_object: Earth Engine object to export

362

filename: Output filename (optional)

363

**kwargs: Additional parameters

364

365

Returns:

366

GeoJSON dictionary if no filename specified

367

"""

368

```

369

370

### Video Export

371

372

Export Earth Engine image collections as video animations.

373

374

```python { .api }

375

def ee_export_video_to_drive(

376

collection: ee.ImageCollection,

377

description: str,

378

folder: str = None,

379

fileNamePrefix: str = None,

380

framesPerSecond: int = 1,

381

dimensions: int = None,

382

region: ee.Geometry = None,

383

scale: float = None,

384

crs: str = None,

385

crsTransform: List[float] = None,

386

maxPixels: int = 1e13,

387

maxFrames: int = 1000,

388

**kwargs

389

) -> ee.batch.Task:

390

"""

391

Export Earth Engine image collection as video to Google Drive.

392

393

Args:

394

collection: Earth Engine ImageCollection to export

395

description: Task description

396

folder: Drive folder name

397

fileNamePrefix: Output file name prefix

398

framesPerSecond: Video frame rate

399

dimensions: Video dimensions

400

region: Export region

401

scale: Export resolution in meters

402

crs: Coordinate reference system

403

crsTransform: Coordinate transform matrix

404

maxPixels: Maximum pixels per frame

405

maxFrames: Maximum number of frames

406

**kwargs: Additional parameters

407

408

Returns:

409

Export task object

410

"""

411

412

def ee_export_video_to_cloud_storage(

413

collection: ee.ImageCollection,

414

description: str,

415

bucket: str,

416

fileNamePrefix: str = None,

417

framesPerSecond: int = 1,

418

dimensions: int = None,

419

region: ee.Geometry = None,

420

scale: float = None,

421

crs: str = None,

422

crsTransform: List[float] = None,

423

maxPixels: int = 1e13,

424

maxFrames: int = 1000,

425

**kwargs

426

) -> ee.batch.Task:

427

"""

428

Export Earth Engine image collection as video to Google Cloud Storage.

429

430

Args:

431

collection: Earth Engine ImageCollection to export

432

description: Task description

433

bucket: GCS bucket name

434

fileNamePrefix: Output file name prefix

435

framesPerSecond: Video frame rate

436

dimensions: Video dimensions

437

region: Export region

438

scale: Export resolution in meters

439

crs: Coordinate reference system

440

crsTransform: Coordinate transform matrix

441

maxPixels: Maximum pixels per frame

442

maxFrames: Maximum number of frames

443

**kwargs: Additional parameters

444

445

Returns:

446

Export task object

447

"""

448

```

449

450

### Task Management

451

452

Monitor and manage Earth Engine export tasks.

453

454

```python { .api }

455

def ee_export_map_to_cloud_storage(

456

ee_object,

457

description: str,

458

bucket: str,

459

**kwargs

460

) -> ee.batch.Task:

461

"""

462

Export map tiles to Google Cloud Storage.

463

464

Args:

465

ee_object: Earth Engine object to export

466

description: Task description

467

bucket: GCS bucket name

468

**kwargs: Additional parameters

469

470

Returns:

471

Export task object

472

"""

473

```

474

475

## Usage Examples

476

477

### Basic Image Export

478

479

```python

480

import geemap

481

import ee

482

483

# Initialize Earth Engine

484

ee.Initialize()

485

486

# Get an image

487

image = ee.Image('USGS/SRTMGL1_003')

488

489

# Export to Google Drive

490

task = geemap.ee_export_image_to_drive(

491

image,

492

description='SRTM_Export',

493

folder='Earth_Engine_Exports',

494

region=ee.Geometry.Rectangle([-120, 35, -119, 36]),

495

scale=30,

496

fileFormat='GeoTIFF'

497

)

498

499

# Start the task

500

task.start()

501

502

# Monitor task status

503

print(task.status())

504

```

505

506

### Image Collection Export

507

508

```python

509

# Get image collection

510

collection = (ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')

511

.filterDate('2020-01-01', '2020-12-31')

512

.filterBounds(ee.Geometry.Point([-122, 37]))

513

.limit(10))

514

515

# Export collection to Drive

516

tasks = geemap.ee_export_image_collection_to_drive(

517

collection,

518

folder='Landsat_Collection',

519

scale=30,

520

region=ee.Geometry.Rectangle([-122.5, 36.5, -121.5, 37.5])

521

)

522

523

# Start all tasks

524

for task in tasks:

525

task.start()

526

```

527

528

### Vector Data Export

529

530

```python

531

# Get feature collection

532

countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017')

533

usa = countries.filter(ee.Filter.eq('country_na', 'United States'))

534

535

# Export to Google Drive

536

task = geemap.ee_export_vector_to_drive(

537

usa,

538

description='USA_Boundaries',

539

folder='Earth_Engine_Exports',

540

fileFormat='SHP'

541

)

542

543

task.start()

544

```

545

546

## Types

547

548

```python { .api }

549

# Export task type

550

ExportTask = ee.batch.Task

551

552

# Export parameters

553

ExportParams = Dict[str, Union[str, int, float, bool, List, Dict]]

554

555

# File format options

556

FileFormat = Literal['GeoTIFF', 'TFRecord', 'SHP', 'GeoJSON', 'KML', 'KMZ', 'CSV']

557

558

# Task status

559

TaskStatus = Dict[str, Union[str, int, float]]

560

```