1 /******************************************************************************
2  *
3  * Project:  GDAL Core
4  * Purpose:  Implementation of GDALAllRegister(), primary format registration.
5  * Author:   Frank Warmerdam, warmerdam@pobox.com
6  *
7  ******************************************************************************
8  * Copyright (c) 1998, Frank Warmerdam
9  * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #include "gdal_priv.h"
31 #include "gdal_frmts.h"
32 #include "ogrsf_frmts.h"
33 
34 #ifdef GNM_ENABLED
35    #include "gnm_frmts.h"
36 #endif
37 
38 CPL_CVSID("$Id: gdalallregister.cpp 55ded3e021103ffa5634561565ba0ea37aab66ad 2021-02-28 00:00:37 +0100 Even Rouault $")
39 
40 #ifdef notdef
41 // we may have a use for this some day
42 static char *szConfiguredFormats = "GDAL_FORMATS";
43 #endif
44 
45 /************************************************************************/
46 /*                          GDALAllRegister()                           */
47 /*                                                                      */
48 /*      Register all identifiably supported formats.                    */
49 /************************************************************************/
50 
51 /**
52  * Register all known configured GDAL drivers.
53  *
54  * This function will drive any of the following that are configured into
55  * GDAL.  See <a href="http://gdal.org/formats_list.html">raster list</a> and
56  * <a href="http://gdal.org/ogr_formats.html">vector full list</a>
57  *
58  * This function should generally be called once at the beginning of the
59  * application.
60  */
61 
GDALAllRegister()62 void CPL_STDCALL GDALAllRegister()
63 
64 {
65     // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined.
66     GetGDALDriverManager()->AutoLoadDrivers();
67 
68 #ifdef FRMT_vrt
69     GDALRegister_VRT();
70     GDALRegister_Derived();
71 #endif
72 
73 #ifdef FRMT_gtiff
74     GDALRegister_GTiff();
75     GDALRegister_COG();
76 #endif
77 
78 #ifdef FRMT_nitf
79     GDALRegister_NITF();
80     GDALRegister_RPFTOC();
81     GDALRegister_ECRGTOC();
82 #endif
83 
84 #ifdef FRMT_hfa
85     GDALRegister_HFA();
86 #endif
87 
88 #ifdef FRMT_ceos2
89     GDALRegister_SAR_CEOS();
90 #endif
91 
92 #ifdef FRMT_ceos
93     GDALRegister_CEOS();
94 #endif
95 
96 #ifdef FRMT_jaxapalsar
97     GDALRegister_PALSARJaxa();
98 #endif
99 
100 #ifdef FRMT_gff
101     GDALRegister_GFF();
102 #endif
103 
104 #ifdef FRMT_elas
105     GDALRegister_ELAS();
106 #endif
107 
108 #ifdef FRMT_esric
109     GDALRegister_ESRIC();
110 #endif
111 
112 #ifdef FRMT_aigrid
113 //    GDALRegister_AIGrid2();
114     GDALRegister_AIGrid();
115 #endif
116 
117 #ifdef FRMT_aaigrid
118     GDALRegister_AAIGrid();
119     GDALRegister_GRASSASCIIGrid();
120     GDALRegister_ISG();
121 #endif
122 
123 #ifdef FRMT_sdts
124     GDALRegister_SDTS();
125 #endif
126 
127 #ifdef FRMT_dted
128     GDALRegister_DTED();
129 #endif
130 
131 #ifdef FRMT_png
132     GDALRegister_PNG();
133 #endif
134 
135 #ifdef FRMT_dds
136     GDALRegister_DDS();
137 #endif
138 
139 #ifdef FRMT_gta
140     GDALRegister_GTA();
141 #endif
142 
143 #ifdef FRMT_jpeg
144     GDALRegister_JPEG();
145 #endif
146 
147 #ifdef FRMT_mem
148     GDALRegister_MEM();
149 #endif
150 
151 #ifdef FRMT_jdem
152     GDALRegister_JDEM();
153 #endif
154 
155 #ifdef FRMT_rasdaman
156     GDALRegister_RASDAMAN();
157 #endif
158 
159 #ifdef FRMT_gif
160     GDALRegister_GIF();
161     GDALRegister_BIGGIF();
162 #endif
163 
164 #ifdef FRMT_envisat
165     GDALRegister_Envisat();
166 #endif
167 
168 #ifdef FRMT_fits
169     GDALRegister_FITS();
170 #endif
171 
172 #ifdef FRMT_bsb
173     GDALRegister_BSB();
174 #endif
175 
176 #ifdef FRMT_xpm
177     GDALRegister_XPM();
178 #endif
179 
180 #ifdef FRMT_bmp
181     GDALRegister_BMP();
182 #endif
183 
184 #ifdef FRMT_dimap
185     GDALRegister_DIMAP();
186 #endif
187 
188 #ifdef FRMT_airsar
189     GDALRegister_AirSAR();
190 #endif
191 
192 #ifdef FRMT_rs2
193     GDALRegister_RS2();
194 #endif
195 
196 #ifdef FRMT_safe
197     GDALRegister_SAFE();
198 #endif
199 
200 #ifdef FRMT_pcidsk
201     GDALRegister_PCIDSK();
202 #endif
203 
204 #ifdef FRMT_pcraster
205     GDALRegister_PCRaster();
206 #endif
207 
208 #ifdef FRMT_ilwis
209     GDALRegister_ILWIS();
210 #endif
211 
212 #ifdef FRMT_sgi
213     GDALRegister_SGI();
214 #endif
215 
216 #ifdef FRMT_srtmhgt
217     GDALRegister_SRTMHGT();
218 #endif
219 
220 #ifdef FRMT_leveller
221     GDALRegister_Leveller();
222 #endif
223 
224 #ifdef FRMT_terragen
225     GDALRegister_Terragen();
226 #endif
227 
228 #ifdef FRMT_netcdf
229     GDALRegister_GMT();
230     GDALRegister_netCDF();
231 #endif
232 
233 #ifdef FRMT_hdf4
234     GDALRegister_HDF4();
235     GDALRegister_HDF4Image();
236 #endif
237 
238 #ifdef FRMT_pds
239     GDALRegister_ISIS3();
240     GDALRegister_ISIS2();
241     GDALRegister_PDS();
242     GDALRegister_PDS4();
243     GDALRegister_VICAR();
244 #endif
245 
246 #ifdef FRMT_til
247     GDALRegister_TIL();
248 #endif
249 
250 #ifdef FRMT_ers
251     GDALRegister_ERS();
252 #endif
253 
254 #ifdef FRMT_jp2kak
255     // JPEG2000 support using Kakadu toolkit
256     GDALRegister_JP2KAK();
257 #endif
258 
259 #ifdef FRMT_jpipkak
260     // JPEG2000 support using Kakadu toolkit
261     GDALRegister_JPIPKAK();
262 #endif
263 
264 #ifdef FRMT_jp2lura
265     // JPEG2000 support using Lurawave library
266     GDALRegister_JP2Lura();
267 #endif
268 
269 #ifdef FRMT_ecw
270     GDALRegister_ECW();
271     GDALRegister_JP2ECW();
272 #endif
273 
274 #ifdef FRMT_openjpeg
275     // JPEG2000 support using OpenJPEG library
276     GDALRegister_JP2OpenJPEG();
277 #endif
278 
279 #ifdef FRMT_l1b
280     GDALRegister_L1B();
281 #endif
282 
283 #ifdef FRMT_fit
284     GDALRegister_FIT();
285 #endif
286 
287 #ifdef FRMT_grib
288     GDALRegister_GRIB();
289 #endif
290 
291 #ifdef FRMT_mrsid
292     GDALRegister_MrSID();
293 #endif
294 
295 #ifdef FRMT_jpeg2000
296     // JPEG2000 support using JasPer toolkit
297     // This one should always be placed after other JasPer supported formats,
298     // such as BMP or PNM. In other case we will get bad side effects.
299     GDALRegister_JPEG2000();
300 #endif
301 
302 #ifdef FRMT_mrsid_lidar
303     GDALRegister_MG4Lidar();
304 #endif
305 
306 #ifdef FRMT_rmf
307     GDALRegister_RMF();
308 #endif
309 
310 #ifdef FRMT_wcs
311     GDALRegister_WCS();
312 #endif
313 
314 #ifdef FRMT_wms
315     GDALRegister_WMS();
316 #endif
317 
318 #ifdef FRMT_msgn
319     GDALRegister_MSGN();
320 #endif
321 
322 #ifdef FRMT_msg
323     GDALRegister_MSG();
324 #endif
325 
326 #ifdef FRMT_idrisi
327     GDALRegister_IDRISI();
328 #endif
329 
330 #ifdef FRMT_ingr
331     GDALRegister_INGR();
332 #endif
333 
334 #ifdef FRMT_gsg
335     GDALRegister_GSAG();
336     GDALRegister_GSBG();
337     GDALRegister_GS7BG();
338 #endif
339 
340 #ifdef FRMT_cosar
341     GDALRegister_COSAR();
342 #endif
343 
344 #ifdef FRMT_tsx
345     GDALRegister_TSX();
346 #endif
347 
348 #ifdef FRMT_coasp
349     GDALRegister_COASP();
350 #endif
351 
352 #ifdef FRMT_tms
353     GDALRegister_TMS();
354 #endif
355 
356 #ifdef FRMT_r
357     GDALRegister_R();
358 #endif
359 
360 #ifdef FRMT_map
361     GDALRegister_MAP();
362 #endif
363 
364 #ifdef FRMT_kmlsuperoverlay
365     GDALRegister_KMLSUPEROVERLAY();
366 #endif
367 
368 #ifdef FRMT_webp
369     GDALRegister_WEBP();
370 #endif
371 
372 #ifdef FRMT_pdf
373     GDALRegister_PDF();
374 #endif
375 
376 #ifdef FRMT_rasterlite
377     GDALRegister_Rasterlite();
378 #endif
379 
380 #ifdef FRMT_mbtiles
381     GDALRegister_MBTiles();
382 #endif
383 
384 #ifdef FRMT_plmosaic
385     GDALRegister_PLMOSAIC();
386 #endif
387 
388 #ifdef FRMT_cals
389     GDALRegister_CALS();
390 #endif
391 
392 #ifdef FRMT_wmts
393     GDALRegister_WMTS();
394 #endif
395 
396 #ifdef FRMT_sentinel2
397     GDALRegister_SENTINEL2();
398 #endif
399 
400 #ifdef FRMT_mrf
401     GDALRegister_mrf();
402 #endif
403 
404 #ifdef FRMT_tiledb
405     GDALRegister_TileDB();
406 #endif
407 
408 #ifdef FRMT_rdb
409     GDALRegister_RDB();
410 #endif
411 /* -------------------------------------------------------------------- */
412 /*      Put raw formats at the end of the list. These drivers support   */
413 /*      various ASCII-header labeled formats, so the driver could be    */
414 /*      confused if you have files in some of above formats and such    */
415 /*      ASCII-header in the same directory.                             */
416 /* -------------------------------------------------------------------- */
417 
418 #ifdef FRMT_raw
419     GDALRegister_PNM();
420     GDALRegister_DOQ1();
421     GDALRegister_DOQ2();
422     GDALRegister_PAux();
423     GDALRegister_MFF();
424     GDALRegister_HKV();
425     GDALRegister_FujiBAS();
426     GDALRegister_GSC();
427     GDALRegister_FAST();
428     GDALRegister_BT();
429     GDALRegister_LAN();
430     GDALRegister_CPG();
431     GDALRegister_IDA();
432     GDALRegister_NDF();
433     GDALRegister_EIR();
434     GDALRegister_DIPEx();
435     GDALRegister_LCP();
436     GDALRegister_GTX();
437     GDALRegister_LOSLAS();
438     GDALRegister_NTv2();
439     GDALRegister_CTable2();
440     GDALRegister_ACE2();
441     GDALRegister_SNODAS();
442     GDALRegister_KRO();
443     GDALRegister_ROIPAC();
444     GDALRegister_RRASTER();
445     GDALRegister_BYN();
446 #endif
447 
448 #ifdef FRMT_arg
449     GDALRegister_ARG();
450 #endif
451 
452 /* -------------------------------------------------------------------- */
453 /*      Our test for the following is weak or expensive so we try       */
454 /*      them last.                                                      */
455 /* -------------------------------------------------------------------- */
456 
457 #ifdef FRMT_rik
458     GDALRegister_RIK();
459 #endif
460 
461 #ifdef FRMT_usgsdem
462     GDALRegister_USGSDEM();
463 #endif
464 
465 #ifdef FRMT_gxf
466     GDALRegister_GXF();
467 #endif
468 
469 #ifdef FRMT_grass
470     GDALRegister_GRASS();
471 #endif
472 
473 #ifdef FRMT_dods
474     GDALRegister_DODS();
475 #endif
476 
477 /* Register KEA before HDF5 */
478 #ifdef FRMT_kea
479     GDALRegister_KEA();
480 #endif
481 
482 #ifdef FRMT_hdf5
483     GDALRegister_BAG();
484     GDALRegister_HDF5();
485     GDALRegister_HDF5Image();
486 #endif
487 
488 #ifdef FRMT_northwood
489     GDALRegister_NWT_GRD();
490     GDALRegister_NWT_GRC();
491 #endif
492 
493 #ifdef FRMT_adrg
494     GDALRegister_ADRG();
495     GDALRegister_SRP();
496 #endif
497 
498 #ifdef FRMT_blx
499     GDALRegister_BLX();
500 #endif
501 
502 #ifdef FRMT_georaster
503     GDALRegister_GEOR();
504 #endif
505 
506 #ifdef FRMT_postgisraster
507     GDALRegister_PostGISRaster();
508 #endif
509 
510 #ifdef FRMT_saga
511     GDALRegister_SAGA();
512 #endif
513 
514 #ifdef FRMT_xyz
515     GDALRegister_XYZ();
516 #endif
517 
518 #ifdef FRMT_hf2
519     GDALRegister_HF2();
520 #endif
521 
522 #ifdef FRMT_jpegls
523     GDALRegister_JPEGLS();
524 #endif
525 
526 #ifdef FRMT_ozi
527     GDALRegister_OZI();
528 #endif
529 
530 #ifdef FRMT_ctg
531     GDALRegister_CTG();
532 #endif
533 
534 #ifdef FRMT_zmap
535     GDALRegister_ZMap();
536 #endif
537 
538 #ifdef FRMT_ngsgeoid
539     GDALRegister_NGSGEOID();
540 #endif
541 
542 #ifdef FRMT_iris
543     GDALRegister_IRIS();
544 #endif
545 
546 #ifdef FRMT_prf
547     GDALRegister_PRF();
548 #endif
549 
550 #ifdef FRMT_rda
551     GDALRegister_RDA();
552 #endif
553 
554 #ifdef FRMT_eeda
555     GDALRegister_EEDAI();
556     GDALRegister_EEDA();
557 #endif
558 
559 #ifdef FRMT_daas
560     GDALRegister_DAAS();
561 #endif
562 
563 #ifdef FRMT_null
564     GDALRegister_NULL();
565 #endif
566 
567 #ifdef FRMT_sigdem
568     GDALRegister_SIGDEM();
569 #endif
570 
571 #ifdef FRMT_exr
572     GDALRegister_EXR();
573 #endif
574 
575 #ifdef FRMT_heif
576     GDALRegister_HEIF();
577 #endif
578 
579 #ifdef FRMT_tga
580     GDALRegister_TGA();
581 #endif
582 
583 #ifdef FRMT_ogcapi
584     GDALRegister_OGCAPI();
585 #endif
586 
587 #ifdef FRMT_stacta
588     GDALRegister_STACTA();
589 #endif
590 
591     // NOTE: you need to generally your own driver before that line.
592 
593 /* -------------------------------------------------------------------- */
594 /*     GNM and OGR drivers                                              */
595 /* -------------------------------------------------------------------- */
596 #ifdef GNM_ENABLED
597     GNMRegisterAllInternal();
598 #endif
599 
600     OGRRegisterAllInternal();
601 
602 /* -------------------------------------------------------------------- */
603 /*      Put here drivers that absolutely need to look for side car      */
604 /*      files in their Identify()/Open() procedure.                     */
605 /* -------------------------------------------------------------------- */
606 
607 #ifdef FRMT_raw
608     GDALRegister_GenBin();
609     GDALRegister_ENVI();
610     GDALRegister_EHdr();
611     GDALRegister_ISCE();
612 #endif
613 
614 /* -------------------------------------------------------------------- */
615 /*      Register GDAL HTTP last, to let a chance to other drivers       */
616 /*      accepting URL to handle them before.                            */
617 /* -------------------------------------------------------------------- */
618 #ifdef FRMT_wcs
619     GDALRegister_HTTP();
620 #endif
621 
622     GetGDALDriverManager()->AutoLoadPythonDrivers();
623 
624 /* -------------------------------------------------------------------- */
625 /*      Deregister any drivers explicitly marked as suppressed by the   */
626 /*      GDAL_SKIP environment variable.                                 */
627 /* -------------------------------------------------------------------- */
628     GetGDALDriverManager()->AutoSkipDrivers();
629 }
630