|
@@ -7,17 +7,16 @@ __revision__ = '1.0'
|
|
|
|
|
|
# inbuilt libraries
|
|
|
import os
|
|
|
-from typing import List, Optional, Set, Union, Dict, Iterable, Any
|
|
|
from pathlib import Path
|
|
|
-
|
|
|
+from typing import List, Optional, Set, Dict, Iterable, Any
|
|
|
+import siwei_config
|
|
|
# third-party libraries
|
|
|
import requests
|
|
|
-from xmltodict import parse, unparse
|
|
|
-
|
|
|
# custom functions
|
|
|
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.supports import prepare_zip_file, is_valid_xml, is_surrounded_by_quotes
|
|
|
+from xmltodict import parse, unparse
|
|
|
|
|
|
default_gridset_name = "WebMercatorQuadx2" # 默认切片方案
|
|
|
default_seed_type = "seed" # 默认切片请求类型 Type can be seed (add tiles), reseed (replace tiles), or truncate (remove tiles)
|
|
@@ -65,9 +64,9 @@ class FileReader:
|
|
|
class Geoserver:
|
|
|
def __init__(
|
|
|
self,
|
|
|
- service_url: str = "http://192.168.60.2:28085/geoserver", # default deployment url during installation
|
|
|
- username: str = "admin", # default username during geoserver installation
|
|
|
- password: str = "geoserver", # default password during geoserver installation
|
|
|
+ service_url: str = siwei_config.CONFIG['geoserver']['url'], # default deployment url during installation
|
|
|
+ username: str = siwei_config.CONFIG['geoserver']['username'], # default username during geoserver installation
|
|
|
+ password: str = siwei_config.CONFIG['geoserver']['password'], # default password during geoserver installation
|
|
|
request_options: Dict[str, Any] = None # additional parameters to be sent with each request
|
|
|
):
|
|
|
self.service_url = service_url
|
|
@@ -416,7 +415,7 @@ class Geoserver:
|
|
|
return r.json()
|
|
|
else:
|
|
|
return None
|
|
|
- #raise GeoserverException(r.status_code, r.content)
|
|
|
+ # raise GeoserverException(r.status_code, r.content)
|
|
|
|
|
|
def create_layergroup(
|
|
|
self,
|
|
@@ -681,7 +680,7 @@ class Geoserver:
|
|
|
return "Layer group deleted successfully"
|
|
|
else:
|
|
|
return "Layer group deleted successfully"
|
|
|
- #raise GeoserverException(r.status_code, r.content)
|
|
|
+ # raise GeoserverException(r.status_code, r.content)
|
|
|
|
|
|
def add_layer_to_layergroup(
|
|
|
self,
|