OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GDAL.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <vector>
23 
25 
26 class OGRDataSource;
27 class OGRFeature;
28 class OGRSpatialReference;
29 class OGRCoordinateTransformation;
30 class GDALMajorObject;
31 
32 namespace Geospatial {
33 
34 class GDAL {
35  public:
36  static void init();
37  static bool supportsNetworkFileAccess();
38  static bool supportsDriver(const std::string& driver_name);
39  static void setAuthorizationTokens(const std::string& s3_region,
40  const std::string& s3_endpoint,
41  const std::string& s3_access_key,
42  const std::string& s3_secret_key,
43  const std::string& s3_session_token);
44 
46  void operator()(OGRDataSource* datasource);
47  };
48  using DataSourceUqPtr = std::unique_ptr<OGRDataSource, DataSourceDeleter>;
49 
50  struct FeatureDeleter {
51  void operator()(OGRFeature* feature);
52  };
53  using FeatureUqPtr = std::unique_ptr<OGRFeature, FeatureDeleter>;
54 
56  void operator()(OGRSpatialReference* ref);
57  };
58  using SpatialReferenceUqPtr =
59  std::unique_ptr<OGRSpatialReference, SpatialReferenceDeleter>;
60 
62  void operator()(OGRCoordinateTransformation* transformation);
63  };
65  std::unique_ptr<OGRCoordinateTransformation, CoordinateTransformationDeleter>;
66 
67  static DataSourceUqPtr openDataSource(const std::string& name,
68  const import_export::SourceType source_type);
69  static import_export::SourceType getDataSourceType(const std::string& name);
70 
71  static std::vector<std::string> unpackMetadata(char** metadata);
72  static void logMetadata(GDALMajorObject* object);
73  static std::string getMetadataString(char** metadata, const std::string& key);
74 
75  private:
76  static bool initialized_;
77  static std::mutex init_mutex_;
78 };
79 
80 } // namespace Geospatial
static std::vector< std::string > unpackMetadata(char **metadata)
Definition: GDAL.cpp:246
static void logMetadata(GDALMajorObject *object)
Definition: GDAL.cpp:257
static void init()
Definition: GDAL.cpp:67
void operator()(OGRDataSource *datasource)
Definition: GDAL.cpp:288
void operator()(OGRFeature *feature)
Definition: GDAL.cpp:294
std::unique_ptr< OGRFeature, FeatureDeleter > FeatureUqPtr
Definition: GDAL.h:53
void operator()(OGRSpatialReference *ref)
Definition: GDAL.cpp:300
static bool initialized_
Definition: GDAL.h:76
static void setAuthorizationTokens(const std::string &s3_region, const std::string &s3_endpoint, const std::string &s3_access_key, const std::string &s3_secret_key, const std::string &s3_session_token)
Definition: GDAL.cpp:138
static bool supportsNetworkFileAccess()
Definition: GDAL.cpp:123
static std::mutex init_mutex_
Definition: GDAL.h:77
std::unique_ptr< OGRCoordinateTransformation, CoordinateTransformationDeleter > CoordinateTransformationUqPtr
Definition: GDAL.h:65
std::unique_ptr< OGRSpatialReference, SpatialReferenceDeleter > SpatialReferenceUqPtr
Definition: GDAL.h:59
std::unique_ptr< OGRDataSource, DataSourceDeleter > DataSourceUqPtr
Definition: GDAL.h:48
static import_export::SourceType getDataSourceType(const std::string &name)
Definition: GDAL.cpp:211
static bool supportsDriver(const std::string &driver_name)
Definition: GDAL.cpp:131
void operator()(OGRCoordinateTransformation *transformation)
Definition: GDAL.cpp:306
string name
Definition: setup.in.py:72
static DataSourceUqPtr openDataSource(const std::string &name, const import_export::SourceType source_type)
Definition: GDAL.cpp:181
Shared Enum.
static std::string getMetadataString(char **metadata, const std::string &key)
Definition: GDAL.cpp:276