Closed sdc50 closed 1 week ago
in the map
controller, rather than hard coding the wms url:
geoserver_layer = MVLayer(
source='ImageWMS',
options={
'url': geoserver_engine.get_wms_endpoint(),
'params': {'LAYERS': selected_layer},
'serverType': 'geoserver'
},
legend_title=legend_title,
legend_extent=[-114, 36.5, -109, 42.5],
legend_classes=[
MVLegendClass('polygon', 'County', fill='#999999'),
]
)
In the home
controller, rather than having a constant GEOSERVER_URI
:
if WORKSPACE not in workspaces:
from urllib.parse import urlparse
parsed = urlparse(geoserver_engine.public_endpoint)
uri = f'{parsed.scheme}://{parsed.netloc}/{WORKSPACE}'
geoserver_engine.create_workspace(workspace_id=WORKSPACE, uri=uri)
I would prefer for this to be:
if WORKSPACE not in workspaces:
uri = f'{geoserver_engine.base_url}/{WORKSPACE}'
geoserver_engine.create_workspace(workspace_id=WORKSPACE, uri=uri)
But we'd first have to add a base_url
attribute to the geoserver engine.
In the
home
controller, rather than having a constantGEOSERVER_URI
:if WORKSPACE not in workspaces: from urllib.parse import urlparse parsed = urlparse(geoserver_engine.public_endpoint) uri = f'{parsed.scheme}://{parsed.netloc}/{WORKSPACE}' geoserver_engine.create_workspace(workspace_id=WORKSPACE, uri=uri)
I would prefer for this to be:
if WORKSPACE not in workspaces: uri = f'{geoserver_engine.base_url}/{WORKSPACE}' geoserver_engine.create_workspace(workspace_id=WORKSPACE, uri=uri)
But we'd first have to add a
base_url
attribute to the geoserver engine.
The only concern I have with this approach is that it implies that the URI needs to match the engine URL, which it does not. It just has to be a unique ID in URL form. This isn't a bad approach though and the nuance could be explained in a note box.
The GeoServer tutorial has some hard coded paths to GeoServer that make it hard to follow if you are using a different Geoserver configuration than that prescribed by the tutorial. It would be easy to make it more generic and just get the paths from the geoserver_engine.