Skip to content

Commit 3ffb5ec

Browse files
committed
Updated docs for OpenLayers 10.4
1 parent cf93bbe commit 3ffb5ec

File tree

3 files changed

+43
-15
lines changed

3 files changed

+43
-15
lines changed

en/cgi/openlayers.txt

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
MapServer OpenLayers Viewer
88
*****************************************************************************
99

10-
MapServer (since the 6.0 release) provides a simple, built-in method for testing a mapfile
10+
MapServer (since the 6.0 release) provides a simple, built-in method for testing a Mapfile
1111
using OpenLayers. This feature is for testing/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
1717
`rfc 63 <https://mapserver.org/development/rfc/ms-rfc-63.html>`_
1818
and in the ticket https://github.com/MapServer/MapServer/issues/3549
1919

20+
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/>`_.
22+
The MapServer CGI Layer, used by the viewer, can be see in
23+
the `OpenLayers examples <https://openlayers.org/en/latest/examples/mapserver-cgi.html>`_.
2024

2125
Using the OpenLayers viewer
2226
-----------------------------------------------------------------------------
@@ -25,7 +29,7 @@ Using the OpenLayers viewer
2529
Opening the OpenLayers viewer in your browser
2630
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2731

28-
Assuming you are running mapserver on your local machine, and you have
32+
Assuming you are running MapServer on your local machine, and you have
2933
the Itasca demo setup, a basic url would be (split into two lines for
3034
readability)::
3135

@@ -97,18 +101,32 @@ Here is a quick breakdown of the interesting parts of that URL:
97101
Customizing settings
98102
~~~~~~~~~~~~~~~~~~~~
99103

100-
* environment variables::
104+
The viewer relies on two external files - a JavaScript file and a CSS file. By default these are loaded
105+
from ``https://mapserver.org/lib/``, however you can use your own copies of these files if external network access
106+
is restricted by setting the following two :ref:`environment_variables`:
101107

102-
MS_OPENLAYERS_JS_URL - The URL to the OpenLayers javascript library. Per default the library loaded from the MapServer web server.
108+
* ``MS_OPENLAYERS_JS_URL`` - the URL to the OpenLayers JavaScript library.
109+
* ``MS_OPENLAYERS_CSS_URL`` - the URL to the OpenLayers CSS file used for styling.
110+
111+
These variables can also be set in a Mapfile, for example to point to the full OpenLayers build on a CDN
112+
(Content Delivery Network):
113+
114+
.. code-block:: mapfile
115+
116+
CONFIG "MS_OPENLAYERS_CSS_URL" "//cdn.jsdelivr.net/npm/[email protected]/ol.css"
117+
CONFIG "MS_OPENLAYERS_JS_URL" "//cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"
103118

104119
Location of the embedded OpenLayers.js file
105120
-------------------------------------------
106121

107-
If you aren't providing your own OpenLayers library through `MS_OPENLAYERS_JS_URL`,
108-
MapServer will point to a hardcoded filepath of `www.mapserver.org/lib` to find the OpenLayers
109-
library, referred to in [maptemplate.c](https://github.com/MapServer/MapServer/blob/main/src/maptemplate.c#L54).
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
124+
library, referred to in `maptemplate.c <https://github.com/MapServer/MapServer/blob/main/src/maptemplate.c#L54>`_.
125+
126+
This version of OpenLayers is a cut-down version that only contains the classes needed for the
127+
MapServer viewer. The ``ol-mapserver.js`` file is ~200 KB compared to the full library which is ~ 840 KB.
110128

111-
The contents on that `lib` folder is stored in the MapServer documentation repository,
112-
in the [/extra](https://github.com/MapServer/MapServer-documentation/tree/main/extra) folder.
129+
The contents of that `lib` folder is stored in the MapServer documentation repository,
130+
in the `/extra <https://github.com/MapServer/MapServer-documentation/tree/main/extra>`_ folder.
113131
You are warmly encouraged to contribute to upgrading the OpenLayers library, at any time (maybe start
114-
with creating a new [Pull Request](https://github.com/MapServer/MapServer-documentation/pulls) there.
132+
with creating a new `Pull Request <https://github.com/MapServer/MapServer-documentation/pulls>`_ there).

en/mapfile/config.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ A full sample config file is shown below:
151151
# MS_MAPFILE_PATTERN "\.map$"
152152
# MS_XMLMAPFILE_XSLT "/path/to/mapfile.xsl"
153153
# MS_MODE "BROWSE" # default mode for CGI calls
154-
# MS_OPENLAYERS_JS_URL "http://openlayers.org/api/OpenLayers.js"
154+
# MS_OPENLAYERS_CSS_URL "//mapserver.org/lib/10.4.0/ol-mapserver.css" # default value
155+
# MS_OPENLAYERS_JS_URL "//mapserver.org/lib/10.4.0/ol-mapserver.js" # default value
155156
# MS_TEMPPATH "/tmp"
156157
# MS_MAX_OPEN_FILES 200 # maximum number of open files allowed on Windows
157158
# MS_WMS_ERROR_STATUS_CODE "ON" # enable HTTP status code 4xx and 5xx in case of errors on WMS requests

en/optimization/environment_variables.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,21 @@ MS_MODE
314314
.. index::
315315
pair: Environment variables; MS_OPENLAYERS_JS_URL
316316

317+
MS_OPENLAYERS_CSS_URL
318+
The URL to the OpenLayers CSS file used for styling the :ref:`openlayers`.
319+
for instance::
320+
321+
//mapserver.org/lib/10.4.0/ol-mapserver.css
322+
323+
.. index::
324+
pair: Environment variables; MS_OPENLAYERS_JS_URL
325+
317326
MS_OPENLAYERS_JS_URL
318-
The URL to the OpenLayers javascript library (can be used when
319-
testing WMS services using imagetype application/openlayers),
327+
The URL to the OpenLayers JavaScript library used by the :ref:`openlayers` (can be used when
328+
testing WMS services using imagetype ``application/openlayers``),
320329
for instance::
321330

322-
http://openlayers.org/api/OpenLayers.js
331+
//mapserver.org/lib/10.4.0/ol-mapserver.js
323332

324333
.. index::
325334
pair: Environment variables; MS_TEMPPATH

0 commit comments

Comments
 (0)