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 : * Permission is hereby granted, free of charge, to any person obtaining a 11 : * copy of this software and associated documentation files (the "Software"), 12 : * to deal in the Software without restriction, including without limitation 13 : * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 : * and/or sell copies of the Software, and to permit persons to whom the 15 : * Software is furnished to do so, subject to the following conditions: 16 : * 17 : * The above copyright notice and this permission notice shall be included 18 : * in all copies or substantial portions of the Software. 19 : * 20 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 : * DEALINGS IN THE SOFTWARE. 27 : ****************************************************************************/ 28 : 29 : #include "ogrsf_frmts.h" 30 : 31 : #include "ogrplscenesdrivercore.h" 32 : 33 : /************************************************************************/ 34 : /* OGRPLSCENESDriverIdentify() */ 35 : /************************************************************************/ 36 : 37 48801 : int OGRPLSCENESDriverIdentify(GDALOpenInfo *poOpenInfo) 38 : 39 : { 40 48801 : return STARTS_WITH_CI(poOpenInfo->pszFilename, "PLSCENES:"); 41 : } 42 : 43 : /************************************************************************/ 44 : /* OGRPLSCENESDriverSetCommonMetadata() */ 45 : /************************************************************************/ 46 : 47 1219 : void OGRPLSCENESDriverSetCommonMetadata(GDALDriver *poDriver) 48 : { 49 1219 : poDriver->SetDescription(DRIVER_NAME); 50 1219 : poDriver->SetMetadataItem(GDAL_DCAP_RASTER, "YES"); 51 1219 : poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES"); 52 1219 : poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "Planet Labs Scenes API"); 53 1219 : poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC, 54 1219 : "drivers/vector/plscenes.html"); 55 1219 : poDriver->SetMetadataItem(GDAL_DMD_CONNECTION_PREFIX, "PLSCENES:"); 56 1219 : poDriver->SetMetadataItem( 57 : GDAL_DMD_OPENOPTIONLIST, 58 : "<OpenOptionList>" 59 : " <Option name='VERSION' type='string-select' description='API " 60 : "version' default='DATA_V1'>" 61 : " <Value>DATA_V1</Value>" 62 : " </Option>" 63 : " <Option name='API_KEY' type='string' description='Account API key' " 64 : "required='true'/>" 65 : " <Option name='FOLLOW_LINKS' type='boolean' description='Whether " 66 : "assets links should be followed for each scene' default='NO'/>" 67 : " <Option name='SCENE' type='string' description='Scene id (for " 68 : "raster fetching)'/>" 69 : " <Option name='ITEMTYPES' alias='CATALOG' type='string' " 70 : "description='Catalog id (mandatory for raster fetching)'/>" 71 : " <Option name='ASSET' type='string' description='Asset category' " 72 : "default='visual'/>" 73 : " <Option name='RANDOM_ACCESS' type='boolean' description='Whether " 74 : "raster should be accessed in random access mode (but with potentially " 75 : "not optimal throughput). If no, in-memory ingestion is done' " 76 : "default='YES'/>" 77 : " <Option name='ACTIVATION_TIMEOUT' type='int' description='Number of " 78 : "seconds during which to wait for asset activation (raster)' " 79 : "default='3600'/>" 80 : " <Option name='FILTER' type='string' description='Custom filter'/>" 81 : " <Option name='METADATA' type='boolean' description='(Raster only) " 82 : "Whether scene metadata should be fetched from the API and attached to " 83 : "the raster dataset' default='YES'/>" 84 1219 : "</OpenOptionList>"); 85 1219 : poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS, "OGRSQL SQLITE"); 86 : 87 1219 : poDriver->pfnIdentify = OGRPLSCENESDriverIdentify; 88 1219 : poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES"); 89 1219 : } 90 : 91 : /************************************************************************/ 92 : /* DeclareDeferredOGRPLSCENESPlugin() */ 93 : /************************************************************************/ 94 : 95 : #ifdef PLUGIN_FILENAME 96 : void DeclareDeferredOGRPLSCENESPlugin() 97 : { 98 : if (GDALGetDriverByName(DRIVER_NAME) != nullptr) 99 : { 100 : return; 101 : } 102 : auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME); 103 : #ifdef PLUGIN_INSTALLATION_MESSAGE 104 : poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE, 105 : PLUGIN_INSTALLATION_MESSAGE); 106 : #endif 107 : OGRPLSCENESDriverSetCommonMetadata(poDriver); 108 : GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver); 109 : } 110 : #endif