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
a8957669
Commit
a8957669
authored
1 year ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
add model metadata. Hide popup when user clicks outside of layer
parent
4bec84a3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
spatial/static/spatial/js/slidingMap.js
+22
-3
22 additions, 3 deletions
spatial/static/spatial/js/slidingMap.js
spatial/templates/spatial/slidingMap.html
+4
-0
4 additions, 0 deletions
spatial/templates/spatial/slidingMap.html
with
26 additions
and
3 deletions
spatial/static/spatial/js/slidingMap.js
+
22
−
3
View file @
a8957669
...
...
@@ -59,9 +59,11 @@ async function initSlidingMap(lonLat, zoomLevel, mapAttribution) {
// Get layers from WMS service
let
parser
=
new
ol
.
format
.
WMSCapabilities
();
let
response
=
await
fetch
(
mapserverURL
+
modelId
+
"
?service=WMS&version=1.3.0&request=GetCapabilities
"
);
let
result
=
parser
.
read
(
await
response
.
text
());
let
WMSLayers
=
result
.
Capability
.
Layer
.
Layer
;
//console.info(WMSLayers[0]);
let
capabilities
=
parser
.
read
(
await
response
.
text
());
let
WMSLayers
=
capabilities
.
Capability
.
Layer
.
Layer
;
document
.
getElementById
(
"
modelTitle
"
).
innerHTML
=
capabilities
.
Service
.
Title
;
document
.
getElementById
(
"
modelAbstract
"
).
innerHTML
=
capabilities
.
Service
.
Abstract
.
replaceAll
(
"
\n\n
"
,
"
XXX
"
);
//console.info(capabilities.Service.Abstract);
// Analyze and organize layers
// First dimension: Time
...
...
@@ -190,12 +192,26 @@ async function displayQueryResult(evt)
let
response
=
await
fetch
(
url
);
let
responseXML
=
await
response
.
text
();
// User clicked outside of layer extent
if
(
responseXML
.
trim
().
length
==
0
)
{
let
popupElement
=
popup
.
getElement
();
$
(
popupElement
).
popover
(
'
destroy
'
);
return
;
}
const
parser
=
new
DOMParser
();
const
xmlDOM
=
parser
.
parseFromString
(
responseXML
,
"
text/xml
"
);
const
result
=
xmlDOM
.
getElementsByTagName
(
"
vipsResult
"
)[
0
]
if
(
result
)
{
// We may or may not have warning status included
let
warningStatus
=
xmlDOM
.
getElementsByTagName
(
"
warningStatus
"
).
length
==
1
?
xmlDOM
.
getElementsByTagName
(
"
warningStatus
"
)[
0
].
getAttribute
(
"
value
"
)
:
null
;
if
(
warningStatus
==
-
1
)
{
let
popupElement
=
popup
.
getElement
();
$
(
popupElement
).
popover
(
'
destroy
'
);
return
;
}
let
parameters
=
{};
let
parameterElements
=
xmlDOM
.
getElementsByTagName
(
"
parameter
"
);
for
(
let
i
=
0
;
i
<
parameterElements
.
length
;
i
++
)
...
...
@@ -232,4 +248,7 @@ async function displayQueryResult(evt)
});
$
(
popupElement
).
popover
(
'
show
'
);
}
else
{
alert
(
"
An error occured. No model data was returned from the server. This is what the server returned:
"
+
responseXML
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
spatial/templates/spatial/slidingMap.html
+
4
−
0
View file @
a8957669
...
...
@@ -34,5 +34,9 @@
</div>
</div>
<div
id=
"popup"
title=
"Location details"
></div>
<div
class=
"col-md-12"
>
<h2
id=
"modelTitle"
></h2>
<div
id=
"modelAbstract"
></div>
</div>
{% endblock %}
\ No newline at end of file
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