Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: PlanetLabs scene driver 4 : * Purpose: PlanetLabs scene driver 5 : * Author: Even Rouault, even dot rouault at spatialys.com 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2015-2016, Planet Labs 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #include "ogrsf_frmts.h" 14 : 15 : #include "ogrplscenesdrivercore.h" 16 : 17 : /************************************************************************/ 18 : /* OGRPLSCENESDriverIdentify() */ 19 : /************************************************************************/ 20 : 21 51983 : int OGRPLSCENESDriverIdentify(GDALOpenInfo *poOpenInfo) 22 : 23 : { 24 51983 : return STARTS_WITH_CI(poOpenInfo->pszFilename, "PLSCENES:"); 25 : } 26 : 27 : /************************************************************************/ 28 : /* OGRPLSCENESDriverSetCommonMetadata() */ 29 : /************************************************************************/ 30 : 31 1293 : void OGRPLSCENESDriverSetCommonMetadata(GDALDriver *poDriver) 32 : { 33 1293 : poDriver->SetDescription(DRIVER_NAME); 34 1293 : poDriver->SetMetadataItem(GDAL_DCAP_RASTER, "YES"); 35 1293 : poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES"); 36 1293 : poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "Planet Labs Scenes API"); 37 1293 : poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC, 38 1293 : "drivers/vector/plscenes.html"); 39 1293 : poDriver->SetMetadataItem(GDAL_DMD_CONNECTION_PREFIX, "PLSCENES:"); 40 1293 : poDriver->SetMetadataItem( 41 : GDAL_DMD_OPENOPTIONLIST, 42 : "<OpenOptionList>" 43 : " <Option name='VERSION' type='string-select' description='API " 44 : "version' default='DATA_V1'>" 45 : " <Value>DATA_V1</Value>" 46 : " </Option>" 47 : " <Option name='API_KEY' type='string' description='Account API key' " 48 : "required='true'/>" 49 : " <Option name='FOLLOW_LINKS' type='boolean' description='Whether " 50 : "assets links should be followed for each scene' default='NO'/>" 51 : " <Option name='SCENE' type='string' description='Scene id (for " 52 : "raster fetching)'/>" 53 : " <Option name='ITEMTYPES' alias='CATALOG' type='string' " 54 : "description='Catalog id (mandatory for raster fetching)'/>" 55 : " <Option name='ASSET' type='string' description='Asset category' " 56 : "default='visual'/>" 57 : " <Option name='RANDOM_ACCESS' type='boolean' description='Whether " 58 : "raster should be accessed in random access mode (but with potentially " 59 : "not optimal throughput). If no, in-memory ingestion is done' " 60 : "default='YES'/>" 61 : " <Option name='ACTIVATION_TIMEOUT' type='int' description='Number of " 62 : "seconds during which to wait for asset activation (raster)' " 63 : "default='3600'/>" 64 : " <Option name='FILTER' type='string' description='Custom filter'/>" 65 : " <Option name='METADATA' type='boolean' description='(Raster only) " 66 : "Whether scene metadata should be fetched from the API and attached to " 67 : "the raster dataset' default='YES'/>" 68 1293 : "</OpenOptionList>"); 69 1293 : poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS, "OGRSQL SQLITE"); 70 : 71 1293 : poDriver->pfnIdentify = OGRPLSCENESDriverIdentify; 72 1293 : poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES"); 73 1293 : } 74 : 75 : /************************************************************************/ 76 : /* DeclareDeferredOGRPLSCENESPlugin() */ 77 : /************************************************************************/ 78 : 79 : #ifdef PLUGIN_FILENAME 80 : void DeclareDeferredOGRPLSCENESPlugin() 81 : { 82 : if (GDALGetDriverByName(DRIVER_NAME) != nullptr) 83 : { 84 : return; 85 : } 86 : auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME); 87 : #ifdef PLUGIN_INSTALLATION_MESSAGE 88 : poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE, 89 : PLUGIN_INSTALLATION_MESSAGE); 90 : #endif 91 : OGRPLSCENESDriverSetCommonMetadata(poDriver); 92 : GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver); 93 : } 94 : #endif