Skip to content

Commit 992e6b4

Browse files
authored
Merge pull request #1022 from geographika/ol-update-proj
Add new ol-mapserver.js version, update docs with demo links
2 parents 3a36a56 + 53e3643 commit 992e6b4

File tree

5 files changed

+396
-24
lines changed

5 files changed

+396
-24
lines changed

en/cgi/openlayers.txt

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
*****************************************************************************
99

1010
MapServer (since the 6.0 release) provides a simple, built-in method for testing a Mapfile
11-
using OpenLayers. This feature is for testing/development purposes
11+
using OpenLayers. This feature is for testing and development purposes
1212
only, and not for production or deploying full-featured sites. You
13-
can preview, test, and navigate a Mapfile by accessing a special url
13+
can preview, test, and navigate a Mapfile by accessing a special URL
1414
which will return a built-in OpenLayers template.
1515

1616
.. note:: This feature was discussed in
17-
`rfc 63 <https://mapserver.org/development/rfc/ms-rfc-63.html>`_
17+
`RFC 63 <https://mapserver.org/development/rfc/ms-rfc-63.html>`_
1818
and in the ticket https://github.com/MapServer/MapServer/issues/3549
1919

2020
Up to the MapServer 8.4 release the OpenLayers Viewer was based on `OpenLayers 2 <https://openlayers.org/two/>`_.
21-
As of MapServer 8.6 the OpenLayers viewer was updated to work with `OpenLayers 10.4+ <https://openlayers.org/>`_.
21+
As of MapServer 8.6 the OpenLayers viewer was updated to work with `OpenLayers 10.5+ <https://openlayers.org/>`_.
2222
The MapServer CGI Layer, used by the viewer, can be see in
2323
the `OpenLayers examples <https://openlayers.org/en/latest/examples/mapserver-cgi.html>`_.
2424

@@ -30,37 +30,40 @@ Opening the OpenLayers viewer in your browser
3030
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3131

3232
Assuming you are running MapServer on your local machine, and you have
33-
the Itasca demo setup, a basic url would be (split into two lines for
34-
readability)::
33+
the Itasca demo setup, a basic URL would be::
3534

36-
http://localhost/cgi-bin/mapserv?mode=browse&template=openlayers
37-
&layer=lakespy2&layer=dlgstln2&map=/var/www/workshop/itasca.map
35+
http://localhost/cgi-bin/mapserv?mode=browse&template=openlayers&layer=lakespy2&layer=dlgstln2&map=/var/www/workshop/itasca.map
3836

39-
Here is a quick breakdown of that url:
37+
Here is a quick breakdown of that URL:
4038

4139
* Basic Parameters for activating the OpenLayers browser::
4240

4341
template=openlayers
4442
mode=browse
4543

4644

47-
* Basic Map / Layer Parameters::
45+
* Basic Map / Layer parameters::
4846

4947
map=/var/www/workshop/itasca.map
5048
layer=lakespy2
5149
layer=dlgstln2
5250

53-
**That's it!**
51+
When using the ``mode=browse`` MapServer will create an image on the server. By default this will be in the same folder as the Mapfile.
52+
If this MapServer cannot write to this folder you will see an error similar to:
53+
54+
.. code-block:: bash
55+
56+
msSaveImage(): Unable to access file. Failed to create output file (/etc/mapserver/Test174833722471.png).
5457

55-
.. uncomment me when the demo server is up to 6.0
56-
.. If you don't have a live MapServer install to play with, you can also try this out on the demo server::
57-
..
58-
.. https://demo.mapserver.org/cgi-bin/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=-180,-90,180,90&SRS=EPSG:4326&WIDTH=953&HEIGHT=480&LAYERS=bluemarble,continents,country_bounds,cities&STYLES=&FORMAT=image/png&TRANSPARENT=true&mode=browse&template=openlayers
59-
..
58+
In this case you will need to set your :ref:`IMAGEPATH <mapfile-web-imagepath>` to a folder MapServer can write to.
6059

60+
**That's it!**
61+
62+
If you don't have a live MapServer install to play with, you can also try the
63+
`MapServer demo <https://demo.mapserver.org/cgi-bin/wms?mode=browse&template=openlayers&layer=continents&layer=country_bounds>`__.
6164

6265
Opening the OpenLayers viewer in the form of a WMS request
63-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6467

6568
This feature is useful when debugging WMS requests. You can write one
6669
of these by hand, or copy the URL for a WMS tile. Running the
@@ -85,18 +88,24 @@ Here is a quick breakdown of the interesting parts of that URL:
8588

8689
* Basic WMS parameters::
8790

88-
#Layers, our bounding box and projection
91+
# Layers, our bounding box and projection
8992
LAYERS=lakespy2
9093
BBOX=429956.19803725,5231780.0814818,444078.32296225,5245902.2064068
9194
SRS=EPSG:26915
9295

93-
#Version and other WMS request params
96+
# Version and other WMS request parameters
9497
SERVICE=WMS
95-
VERSION=1.1.1
98+
VERSION=1.3.0
9699
REQUEST=GetMap
97100
WIDTH=512
98101
HEIGHT=512
99102
TRANSPARENT=true
103+
CRS=EPSG:4326
104+
BBOX=-90,-180,90,180
105+
STYLES=
106+
107+
If you don't have a live MapServer install to play with, you try the
108+
`MapServer demo <https://demo.mapserver.org/cgi-bin/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-90,-180,90,180&CRS=EPSG:4326&WIDTH=953&HEIGHT=480&LAYERS=bluemarble,continents,country_bounds,cities&STYLES=&FORMAT=application/openlayers&TRANSPARENT=true`__.>`__.
100109

101110
Customizing settings
102111
~~~~~~~~~~~~~~~~~~~~
@@ -113,14 +122,14 @@ These variables can also be set in a Mapfile, for example to point to the full O
113122

114123
.. code-block:: mapfile
115124

116-
CONFIG "MS_OPENLAYERS_CSS_URL" "//cdn.jsdelivr.net/npm/ol@v10.4.0/ol.css"
117-
CONFIG "MS_OPENLAYERS_JS_URL" "//cdn.jsdelivr.net/npm/ol@v10.4.0/dist/ol.js"
125+
CONFIG "MS_OPENLAYERS_CSS_URL" "//cdn.jsdelivr.net/npm/ol@v10.5.0/ol.css"
126+
CONFIG "MS_OPENLAYERS_JS_URL" "//cdn.jsdelivr.net/npm/ol@v10.5.0/dist/ol.js"
118127

119128
Location of the embedded OpenLayers.js file
120129
-------------------------------------------
121130

122-
If you aren't providing your own OpenLayers library through `MS_OPENLAYERS_JS_URL` and
123-
`MS_OPENLAYERS_CSS_URL`, MapServer will point to hardcoded filepaths at `mapserver.org/lib` to find the OpenLayers
131+
If you aren't providing your own OpenLayers library through ``MS_OPENLAYERS_JS_URL`` and
132+
``MS_OPENLAYERS_CSS_URL``, MapServer will point to hard-coded filepaths at `mapserver.org/lib` to find the OpenLayers
124133
library, referred to in `maptemplate.c <https://github.com/MapServer/MapServer/blob/main/src/maptemplate.c#L54>`_.
125134

126135
This version of OpenLayers is a cut-down version that only contains the classes needed for the

0 commit comments

Comments
 (0)