|
@@ -7,17 +7,16 @@ __revision__ = '1.0'
|
|
|
|
|
|
|
|
|
|
import os
|
|
import os
|
|
-from typing import List, Optional, Set, Union, Dict, Iterable, Any
|
|
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
-
|
|
+from typing import List, Optional, Set, Dict, Iterable, Any
|
|
|
|
+import siwei_config
|
|
|
|
|
|
import requests
|
|
import requests
|
|
-from xmltodict import parse, unparse
|
|
|
|
-
|
|
|
|
|
|
|
|
from processing.tools.GeoServer.Calculation_gdal import raster_value
|
|
from processing.tools.GeoServer.Calculation_gdal import raster_value
|
|
from processing.tools.GeoServer.Style import catagorize_xml, classified_xml, coverage_style_xml, outline_only_xml
|
|
from processing.tools.GeoServer.Style import catagorize_xml, classified_xml, coverage_style_xml, outline_only_xml
|
|
from processing.tools.GeoServer.supports import prepare_zip_file, is_valid_xml, is_surrounded_by_quotes
|
|
from processing.tools.GeoServer.supports import prepare_zip_file, is_valid_xml, is_surrounded_by_quotes
|
|
|
|
+from xmltodict import parse, unparse
|
|
|
|
|
|
default_gridset_name = "WebMercatorQuadx2"
|
|
default_gridset_name = "WebMercatorQuadx2"
|
|
default_seed_type = "seed"
|
|
default_seed_type = "seed"
|
|
@@ -65,9 +64,9 @@ class FileReader:
|
|
class Geoserver:
|
|
class Geoserver:
|
|
def __init__(
|
|
def __init__(
|
|
self,
|
|
self,
|
|
- service_url: str = "http://192.168.60.2:28085/geoserver",
|
|
+ service_url: str = siwei_config.CONFIG['geoserver']['url'],
|
|
- username: str = "admin",
|
|
+ username: str = siwei_config.CONFIG['geoserver']['username'],
|
|
- password: str = "geoserver",
|
|
+ password: str = siwei_config.CONFIG['geoserver']['password'],
|
|
request_options: Dict[str, Any] = None
|
|
request_options: Dict[str, Any] = None
|
|
):
|
|
):
|
|
self.service_url = service_url
|
|
self.service_url = service_url
|
|
@@ -416,7 +415,7 @@ class Geoserver:
|
|
return r.json()
|
|
return r.json()
|
|
else:
|
|
else:
|
|
return None
|
|
return None
|
|
-
|
|
+
|
|
|
|
|
|
def create_layergroup(
|
|
def create_layergroup(
|
|
self,
|
|
self,
|
|
@@ -681,7 +680,7 @@ class Geoserver:
|
|
return "Layer group deleted successfully"
|
|
return "Layer group deleted successfully"
|
|
else:
|
|
else:
|
|
return "Layer group deleted successfully"
|
|
return "Layer group deleted successfully"
|
|
-
|
|
+
|
|
|
|
|
|
def add_layer_to_layergroup(
|
|
def add_layer_to_layergroup(
|
|
self,
|
|
self,
|