Skip to content

Commit e9f3132

Browse files
geographikajmckenna
authored andcommitted
Add new ol-mapserver.js version, update docs with demo links
1 parent af46745 commit e9f3132

File tree

5 files changed

+400
-18
lines changed

5 files changed

+400
-18
lines changed

en/cgi/openlayers.txt

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,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

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-dev the OpenLayers viewer was updated to work with `OpenLayers 10.5+ <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,14 +29,12 @@ 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
29-
the Itasca demo setup, a basic url would be (split into two lines for
30-
readability)::
32+
Assuming you are running MapServer on your local machine, and you have
33+
the Itasca demo setup, a basic URL would be::
3134

32-
http://localhost/cgi-bin/mapserv?mode=browse&template=openlayers
33-
&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
3436

35-
Here is a quick breakdown of that url:
37+
Here is a quick breakdown of that URL:
3638

3739
* Basic Parameters for activating the OpenLayers browser::
3840

@@ -46,14 +48,19 @@ Here is a quick breakdown of that url:
4648
layer=lakespy2
4749
layer=dlgstln2
4850

49-
**That's it!**
51+
When using the ``mode=browser`` 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).
5057

51-
.. uncomment me when the demo server is up to 6.0
52-
.. If you don't have a live MapServer install to play with, you can also try this out on the demo server::
53-
..
54-
.. 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
55-
..
58+
In this case you will need to set your :ref:`IMAGEPATH <mapfile-web-imagepath>` to a folder MapServer can write to.
59+
60+
**That's it!**
5661

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>`__.
5764

5865
Opening the OpenLayers viewer in the form of a WMS request
5966
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -86,27 +93,39 @@ Here is a quick breakdown of the interesting parts of that URL:
8693
BBOX=429956.19803725,5231780.0814818,444078.32296225,5245902.2064068
8794
SRS=EPSG:26915
8895

89-
#Version and other WMS request params
96+
#Version and other WMS request parameters
9097
SERVICE=WMS
9198
VERSION=1.1.1
9299
REQUEST=GetMap
93100
WIDTH=512
94101
HEIGHT=512
95102
TRANSPARENT=true
96103

104+
If you don't have a live MapServer install to play with, you try the
105+
`MapServer demo <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=application/openlayers&TRANSPARENT=true>`__.
106+
97107
Customizing settings
98108
~~~~~~~~~~~~~~~~~~~~
99109

100110
* environment variables::
101111

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

104123
Location of the embedded OpenLayers.js file
105124
-------------------------------------------
106125

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).
126+
If you aren't providing your own OpenLayers library through ``MS_OPENLAYERS_JS_URL`` and
127+
``MS_OPENLAYERS_CSS_URL``, MapServer will point to hard-coded filepaths at `mapserver.org/lib` to find the OpenLayers
128+
library, referred to in `maptemplate.c <https://github.com/MapServer/MapServer/blob/main/src/maptemplate.c#L54>`_.
110129

111130
The contents on that `lib` folder is stored in the MapServer documentation repository,
112131
in the [/extra](https://github.com/MapServer/MapServer-documentation/tree/main/extra) folder.

0 commit comments

Comments
 (0)