Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSWeb
Commits
55dc4ee0
Commit
55dc4ee0
authored
1 year ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Get title and abstract from GeoServer WMS (one level below Mapserver's)
parent
c8093b93
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spatial/static/spatial/js/gridmap.js
+19
-5
19 additions, 5 deletions
spatial/static/spatial/js/gridmap.js
with
19 additions
and
5 deletions
spatial/static/spatial/js/gridmap.js
+
19
−
5
View file @
55dc4ee0
...
...
@@ -182,7 +182,9 @@ async function initGridMap(inputModelId, wmsURL, mapAttribution) {
// Get layers from WMS service
let
parser
=
new
ol
.
format
.
WMSCapabilities
();
//console.info(mapserverURL + modelId + "?service=WMS&version=1.3.0&request=GetCapabilities");
let
response
=
await
fetch
(
wmsURL
+
"
?service=WMS&version=1.3.0&request=GetCapabilities&language=
"
+
settings
.
currentLanguage
);
//let response = await fetch(wmsURL + "?service=WMS&version=1.3.0&request=GetCapabilities&language=" + settings.currentLanguage);
let
response
=
await
fetch
(
wmsURL
+
"
?service=WMS&request=GetCapabilities
"
);
//console.info(wmsURL + "?service=WMS&request=GetCapabilities&language=en");
//console.info(response.status); // Response is 200 even if a model doesn't exist on the mapserver
let
txt
=
await
response
.
text
();
...
...
@@ -202,12 +204,24 @@ async function initGridMap(inputModelId, wmsURL, mapAttribution) {
WMSLayers
=
WMSLayers
[
0
].
Layer
;
}
//console.info(WMSLayers);
document
.
getElementById
(
"
modelTitle
"
).
innerHTML
=
capabilities
.
Service
.
Title
;
if
(
capabilities
.
Service
.
Abstract
!=
undefined
)
//console.info(capabilities);
// Get title and abstract. Could be either at top level or the level below
let
modelTitle
=
capabilities
.
Service
.
Title
;
let
modelAbstract
=
undefined
;
if
(
modelTitle
!=
undefined
&&
modelTitle
.
trim
()
!=
""
)
{
modelAbstract
=
capabilities
.
Service
.
Abstract
;
}
else
{
modelTitle
=
capabilities
.
Capability
.
Layer
.
Layer
[
0
].
Title
;
modelAbstract
=
capabilities
.
Capability
.
Layer
.
Layer
[
0
].
Abstract
;
}
document
.
getElementById
(
"
modelTitle
"
).
innerHTML
=
modelTitle
;
if
(
modelAbstract
!=
undefined
)
{
// Placing the sections above/below the map
let
el
=
new
DOMParser
().
parseFromString
(
capabilities
.
Service
.
Abstract
.
replaceAll
(
"
\n\n
"
,
""
),
"
text/html
"
);
let
el
=
new
DOMParser
().
parseFromString
(
model
Abstract
.
replaceAll
(
"
\n\n
"
,
""
),
"
text/html
"
);
let
preamble
=
el
.
getElementById
(
"
preamble
"
)
!=
null
?
el
.
getElementById
(
"
preamble
"
)
:
el
;
document
.
getElementById
(
"
modelAbstractPreamble
"
).
innerHTML
=
new
XMLSerializer
().
serializeToString
(
preamble
);
let
body
=
el
.
getElementById
(
"
body
"
)
!=
null
?
el
.
getElementById
(
"
body
"
)
:
null
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment