move OGR environment variable to plugin (#462)

This commit is contained in:
Tom Kralidis
2020-06-24 20:15:59 -04:00
committed by GitHub
parent 3c4b791830
commit 7766e2533c
2 changed files with 4 additions and 6 deletions
-5
View File
@@ -30,7 +30,6 @@
import importlib
import logging
import os
LOGGER = logging.getLogger(__name__)
@@ -68,10 +67,6 @@ def load_plugin(plugin_type, plugin_def):
name = plugin_def['name']
if name == "OGR":
os.environ["OGR_GEOJSON_MAX_OBJ_SIZE"] = os.environ.get(
"OGR_GEOJSON_MAX_OBJ_SIZE", "20MB")
if plugin_type not in PLUGINS.keys():
msg = 'Plugin type {} not found'.format(plugin_type)
LOGGER.exception(msg)
+4 -1
View File
@@ -29,9 +29,10 @@
#
# =================================================================
import functools
import importlib
import logging
import functools
import os
from typing import Any
from osgeo import gdal as osgeo_gdal
@@ -67,6 +68,8 @@ class OGRProvider(BaseProvider):
'WFS': 'pygeoapi.provider.ogr.WFSHelper',
'*': 'pygeoapi.provider.ogr.CommonSourceHelper'
}
os.environ['OGR_GEOJSON_MAX_OBJ_SIZE'] = os.environ.get(
'OGR_GEOJSON_MAX_OBJ_SIZE', '20MB')
# Setting for traditional CRS axis order.
OAMS_TRADITIONAL_GIS_ORDER = osgeo_osr.OAMS_TRADITIONAL_GIS_ORDER