Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions msautotest/misc/expected/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MapServer Simple Viewer</title>
<link rel="stylesheet" href="//mapserver.org/lib/10.4.0/ol-mapserver.css">
<link rel="stylesheet" href="//mapserver.org/lib/10.5.0/ol-mapserver.css">
<link rel="shortcut icon" type="image/x-icon" href="//mapserver.org/_static/mapserver.ico" />
<style>
#map {
Expand All @@ -18,7 +18,7 @@
</head>
<body>
<div id="map"></div>
<script src="//mapserver.org/lib/10.4.0/ol-mapserver.js"></script>
<script src="//mapserver.org/lib/10.5.0/ol-mapserver.js"></script>
<script>
const mslayer = new ol.layer.Image({
extent: [-180.000000, -180.000000, 180.000000, 180.000000],
Expand Down
7 changes: 5 additions & 2 deletions msautotest/misc/expected/wms.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MapServer Simple Viewer</title>
<link rel="stylesheet" href="//mapserver.org/lib/10.4.0/ol-mapserver.css">
<link rel="stylesheet" href="//mapserver.org/lib/10.5.0/ol-mapserver.css">
<link rel="shortcut icon" type="image/x-icon" href="//mapserver.org/_static/mapserver.ico" />
<style>
#map {
Expand All @@ -18,8 +18,11 @@
</head>
<body>
<div id="map"></div>
<script src="//mapserver.org/lib/10.4.0/ol-mapserver.js"></script>
<script src="//mapserver.org/lib/10.5.0/ol-mapserver.js"></script>
<script>
if (!ol.proj.get('EPSG:4326')) {
ol.proj.addProjection(new ol.proj.Projection({ code : 'EPSG:4326' }));
}
const mslayer = new ol.layer.Image({
source: new ol.source.Image({
loader: ol.source.wms.createLoader({
Expand Down
7 changes: 5 additions & 2 deletions msautotest/misc/expected/wms_projected.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MapServer Simple Viewer</title>
<link rel="stylesheet" href="//mapserver.org/lib/10.4.0/ol-mapserver.css">
<link rel="stylesheet" href="//mapserver.org/lib/10.5.0/ol-mapserver.css">
<link rel="shortcut icon" type="image/x-icon" href="//mapserver.org/_static/mapserver.ico" />
<style>
#map {
Expand All @@ -18,8 +18,11 @@
</head>
<body>
<div id="map"></div>
<script src="//mapserver.org/lib/10.4.0/ol-mapserver.js"></script>
<script src="//mapserver.org/lib/10.5.0/ol-mapserver.js"></script>
<script>
if (!ol.proj.get('EPSG:3857')) {
ol.proj.addProjection(new ol.proj.Projection({ code : 'EPSG:3857' }));
}
const mslayer = new ol.layer.Image({
source: new ol.source.Image({
loader: ol.source.wms.createLoader({
Expand Down
48 changes: 48 additions & 0 deletions msautotest/misc/expected/wms_projected_extra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MapServer Simple Viewer</title>
<link rel="stylesheet" href="//mapserver.org/lib/10.5.0/ol-mapserver.css">
<link rel="shortcut icon" type="image/x-icon" href="//mapserver.org/_static/mapserver.ico" />
<style>
#map {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="//mapserver.org/lib/10.5.0/ol-mapserver.js"></script>
<script>
if (!ol.proj.get('EPSG:3395')) {
ol.proj.addProjection(new ol.proj.Projection({ code : 'EPSG:3395' }));
}
const mslayer = new ol.layer.Image({
source: new ol.source.Image({
loader: ol.source.wms.createLoader({
url: 'http://localhost/?map=msautotest/misc/openlayers.map&',
params: {
LAYERS: 'world-polys,world-lines',
VERSION: '1.3.0',
FORMAT: 'image/png'
},
projection: 'EPSG:3395',
ratio: 1
})
})
});
const map = new ol.Map({
layers: [mslayer],
target: 'map',
view: new ol.View()
});
map.getView().fit([-20016548.603243, -15472271.997468, 20016548.603243, 18740357.487468], { size: map.getSize() });
</script>
</body>
</html>
9 changes: 5 additions & 4 deletions msautotest/misc/openlayers.map
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# RUN_PARMS: browse.html [MAPSERV] QUERY_STRING="map=[MAPFILE]&layers=world-polys world-lines&mode=browse&template=openlayers" > [RESULT_DEMIME]
# RUN_PARMS: wms.html [MAPSERV] QUERY_STRING="map=[MAPFILE]&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=application/openlayers&STYLES=&TRANSPARENT=false&LAYERS=world-polys,world-lines&WIDTH=956&HEIGHT=705&CRS=EPSG:4326&BBOX=-180,-90,180,90" > [RESULT_DEMIME]
# RUN_PARMS: wms_projected.html [MAPSERV] QUERY_STRING="map=[MAPFILE]&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=application/openlayers&STYLES=&TRANSPARENT=false&LAYERS=world-polys,world-lines&WIDTH=956&HEIGHT=705&CRS=EPSG:3857&BBOX=-20037508.34,-20048966.1,20037508.34,20048966.1" > [RESULT_DEMIME]
#
# RUN_PARMS: wms_projected_extra.html [MAPSERV] QUERY_STRING="map=[MAPFILE]&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=application/openlayers&STYLES=&TRANSPARENT=false&LAYERS=world-polys,world-lines&WIDTH=956&HEIGHT=705&CRS=EPSG:3395&BBOX=-20037508.34,-15496570.74,20037508.34,18764656.23" > [RESULT_DEMIME]

# REQUIRES: INPUT=SHAPE OUTPUT=PNG SUPPORTS=PROJ SUPPORTS=WMS
#

Expand All @@ -14,8 +15,8 @@ MAP
SIZE 400 400

# can also test with OpenLayers hosted on a CDN
# CONFIG "MS_OPENLAYERS_JS_URL" "//cdn.jsdelivr.net/npm/ol@v10.4.0/dist/ol.js"
# CONFIG "MS_OPENLAYERS_CSS_URL" "//cdn.jsdelivr.net/npm/ol@v10.4.0/ol.css"
# CONFIG "MS_OPENLAYERS_JS_URL" "//cdn.jsdelivr.net/npm/ol@v10.5.0/dist/ol.js"
# CONFIG "MS_OPENLAYERS_CSS_URL" "//cdn.jsdelivr.net/npm/ol@v10.5.0/ol.css"

WEB
METADATA
Expand All @@ -24,7 +25,7 @@ MAP
# required for both CGI and WMS
"wms_enable_request" "GetMap" # required for WMS testing
# following required for WMS
"wms_srs" "EPSG:4326 EPSG:3857"
"wms_srs" "EPSG:4326 EPSG:3857 EPSG:3395"
END
END

Expand Down
10 changes: 7 additions & 3 deletions src/maptemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ static inline void IGUR_voidp(void *ignored) {
(void)ignored;
} /* Ignore GCC Unused Result */

static const char *const olUrl = "//mapserver.org/lib/10.4.0/ol-mapserver.js";
static const char *const olUrl = "//mapserver.org/lib/10.5.0/ol-mapserver.js";
static const char *const olCssUrl =
"//mapserver.org/lib/10.4.0/ol-mapserver.css";
"//mapserver.org/lib/10.5.0/ol-mapserver.css";

static const char *const olTemplate =
"<!DOCTYPE html>\n"
Expand Down Expand Up @@ -108,7 +108,11 @@ static const char *const olLayerMapServerTag =
" });";

static const char *const olLayerWMSTag =
"const mslayer = new ol.layer.Image({\n"
"if (!ol.proj.get('[openlayers_projection]')) {\n"
" ol.proj.addProjection(new ol.proj.Projection({ code : "
"'[openlayers_projection]' }));\n"
" }\n"
" const mslayer = new ol.layer.Image({\n"
" source: new ol.source.Image({\n"
" loader: ol.source.wms.createLoader({\n"
" url: '[mapserv_onlineresource]',\n"
Expand Down