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
11 changes: 5 additions & 6 deletions workshop/content/docs/advanced/apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ The Apache web server is used by the workshop Docker image. Since version 8.0 Ma

At its heart MapServer is a command-line application that can be accessed through a web server.

https://github.com/camptocamp/docker-mapserver/blob/master/runtime/usr/local/bin/start-server
Apache has a [configuration file](https://github.com/MapServer/getting-started-with-mapserver/blob/main/docker/runtime/etc/apache2/conf-enabled/mapserver.conf).
The Docker image uses a [start-up script(https://github.com/MapServer/getting-started-with-mapserver/blob/main/docker/runtime/usr/local/bin/start-server).

Apache has a [configuration file](https://github.com/camptocamp/docker-mapserver/blob/master/runtime/etc/apache2/conf-enabled/mapserver.conf).

[mod_fcgid module](https://httpd.apache.org/mod_fcgid/), which is an Apache module that provides FastCGI support.
MapServer uses the [mod_fcgid module](https://httpd.apache.org/mod_fcgid/), which is an Apache module that provides FastCGI support.

```
FcgidMaxRequestsPerProcess ${MAX_REQUESTS_PER_PROCESS}
Expand All @@ -27,7 +26,7 @@ FcgidIOTimeout ${IO_TIMEOUT}

These are all documented on the [reference page(https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html).

These all have defaults in the Docker file, but can be overriden using environment variables.
These all have defaults in the Docker file, but can be overridden using environment variables.

```
ENV MS_DEBUGLEVEL=0 \
Expand All @@ -42,7 +41,7 @@ ENV MS_DEBUGLEVEL=0 \
```


All requests to the server are mapped to `mapserv_wrapper` - a small
All requests to the server are mapped to [mapserv_wrapper](https://github.com/MapServer/getting-started-with-mapserver/blob/main/docker/runtime/usr/local/bin/mapserv_wrapper) - a small wrapper script.

```
ScriptAliasMatch "^${MAPSERVER_BASE_PATH}/(.*)" /usr/local/bin/mapserv_wrapper/$1
Expand Down
2 changes: 1 addition & 1 deletion workshop/content/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Getting Started with MapServer

# Welcome to the Getting Started with MapServer workshop!

Version: 1.0
Version: 1.1

![mapserver logo](assets/images/mapserver-banner-large.png)

Expand Down
10 changes: 5 additions & 5 deletions workshop/content/docs/introduction/commandline.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ mapserv -v
This should output the MapServer version, along with other details such as PROJ and GDAL versions, and supported input and output formats:

```
MapServer version 8.4.0 PROJ version 9.5 GDAL version 3.10 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
MapServer version 8.7-dev PROJ version 9.8 GDAL version 3.13 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS
INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF
```

When run through a web server, data is passed to the `mapserv` application, which generates output that is then sent back through the web server.
Expand All @@ -27,7 +27,7 @@ To test a URL such as <http://localhost:7000/?map=/etc/mapserver/countries.map&m
mapserv "QUERY_STRING=map=/etc/mapserver/countries.map&mode=map"
```

This will output a PNG image to the command line - this will look like gargabe!
This will output a PNG image to the command line - this will look like garbage!

We can save the output by redirecting it to a file using `>`.
As the `mapserv` program returns responses for a web client it also returns HTTP headers. To create a valid image file we need to strip these
Expand Down Expand Up @@ -56,7 +56,7 @@ mapserv -nh "QUERY_STRING=map=/etc/mapserver/countries.map&mode=map" > /etc/maps
We can see all command options using the `--help` switch:

```bash
mapserver --help
mapserv --help
```

All MapServer output can be returned on the command line, not just images. For example, to see a WMS GetCapabilities XML response, run the following command:
Expand Down
8 changes: 4 additions & 4 deletions workshop/content/docs/introduction/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ We will be using MapServer on a Docker image for the workshop. This ensures that

## Docker MapServer

The MapServer Docker image is provided by [Camptocamp](https://github.com/camptocamp/docker-mapserver), and the Dockerfile is found [here](https://github.com/camptocamp/docker-mapserver/blob/master/Dockerfile).
A custom MapServer Docker image has been created for the workshop, and the Dockerfile is found [here](https://github.com/MapServer/getting-started-with-mapserver/blob/main/docker/Dockerfile).

MapServer runs on the Apache web server - see the [Apache page](../advanced/apache.md) page for further details.

It uses the Apache [mod_fcgid module](https://httpd.apache.org/mod_fcgid/), module that provides FastCGI support.

MapServer runs on port 80 on the Docker container, which is mapped to port 7000 on the local machine, as can be seen in the Docker compose file
MapServer runs on port `8080` on the Docker container, which is mapped to port `7000` on the local machine, as can be seen in the Docker compose file
located at `workshop\exercises\docker-compose.yml`:

```yaml
mapserver:
image: geographika/mapserver-workshop:latest
container_name: mapserver
ports:
- 7000:80
- 7000:8080
environment:
MAPSERVER_CONFIG_FILE: "/etc/mapserver/mapserver.conf"
volumes:
Expand All @@ -30,7 +30,7 @@ located at `workshop\exercises\docker-compose.yml`:

## JavaScript Application

A second container that serves the JavaScript example pages is also run using Docker. This uses node and runs on port 7001 on both the container and the host machine.
A second container that serves the JavaScript example pages is also run using Docker. This uses Node and runs on port 7001 on both the container and the host machine.

```yaml
node:
Expand Down
6 changes: 3 additions & 3 deletions workshop/content/docs/introduction/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This workshop is divided into the major topics listed below.
1. **Introduction**. An introduction to MapServer and the software used for the workshop. This
includes Docker, OpenLayers, and Apache.

2. The **Mapfile**. A Mapfile is MapServer's configuration file. It points
to the data the Map will display, it defines how the data will be displayed,
2. The **Mapfile**. A Mapfile defines a map and its layers in MapServer. It points
to the data the map will display, it defines how the data will be displayed,
and how the data will be served to client applications such as an Internet
browser. This first set of exercises will help to get familiar with the structure,
keywords, and syntax of a Mapfile.
Expand All @@ -24,7 +24,7 @@ standards as these are free, open and interoperable.
5. **Advanced** topics. These are a collection of miscellaneous exercises that cover
a wide range of MapServer functionality. Selected exercises will be chosen based on the
needs to the workshop participants. MapServer has over 25 years of development and
features so new topics will be added over time.
features, so new topics will be added over time.

## Workshop Outline

Expand Down
3 changes: 2 additions & 1 deletion workshop/content/docs/mapfile/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ GEOMTRANSFORM (centerline(densify([shape], 0.1)))
!!! example

- Direct MapServer request: <http://localhost:7000/?map=/etc/mapserver/lakes.map&mode=map&layer=lakes&layer=lake-labels>
- Inbuilt OpenLayers viewer: <http://localhost:7000/lakes/?template=openlayers&mode=browse&layers=all>
- Local OpenLayers example: <http://localhost:7001/lakes.html>

??? JavaScript "lakes.js"
Expand All @@ -61,7 +62,7 @@ GEOMTRANSFORM (centerline(densify([shape], 0.1)))
1. Use a different font for the label by adding the following to the `LABEL` block: `FONT MonsieurLaDoulaise` and increasing the `SIZE` to `28`.
The list of fonts available can be found in `workshop/exercises/mapfiles/data/fonts/fontset.txt`.
2. Comment out the `GEOMTRANSFORM (centerline([shape]))` and `ANGLE FOLLOW` lines (using `#`) to see its effect on the map.
3. If you have time, download a font you like from https://fonts.google.com/ and unzip the .TTF file to `workshop/exercises/mapfiles/data/fonts/`
3. If you have time, download a font you like from <https://fonts.google.com/> and unzip the .TTF file to `workshop/exercises/mapfiles/data/fonts/`
add a new entry to `fontset.txt` and use this font to draw your Map labels.
<!--
``` xml
Expand Down
1 change: 1 addition & 0 deletions workshop/content/docs/mapfile/lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ END
!!! example

- Direct MapServer request: <http://localhost:7000/?map=/etc/mapserver/lines.map&mode=map&layer=roads>
- Inbuilt OpenLayers viewer: <http://localhost:7000/lines/?template=openlayers&mode=browse&layers=all>
- Local OpenLayers example: <http://localhost:7001/lines.html>

!!! tip
Expand Down
3 changes: 2 additions & 1 deletion workshop/content/docs/mapfile/points.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ LiberationMono LiberationMono-Regular.ttf
LiberationSans LiberationSans-Regular.ttf
```

In the Mapfile itself we then reference this file and use any of the font aliases for symbols and labels.
We then reference this file in the Mapfile, and use any of the font aliases for symbols and labels.

In the example below we're using a
cinema character from Google's [Material Symbols](https://fonts.google.com/icons).
Expand All @@ -66,6 +66,7 @@ END
!!! example

- Direct MapServer request: <http://localhost:7000/?map=/etc/mapserver/points.map&mode=map&layer=pois>
- Inbuilt OpenLayers viewer: <http://localhost:7000/points/?template=openlayers&mode=browse&layers=all>
- Local OpenLayers example: <http://localhost:7001/points.html>

??? JavaScript "points.js"
Expand Down
1 change: 1 addition & 0 deletions workshop/content/docs/mapfile/polygons.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CLASS
!!! example

- Direct MapServer request: <http://localhost:7000/?map=/etc/mapserver/polygons.map&mode=map&layer=buildings>
- Inbuilt OpenLayers viewer: <http://localhost:7000/polygons/?template=openlayers&mode=browse&layers=all>
- Local OpenLayers example: <http://localhost:7001/polygons.html>

!!! tip
Expand Down
14 changes: 7 additions & 7 deletions workshop/content/docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MapServer can be installed directly to various operating systems (see the [docum
for more information), but Docker is used so a fully reproducible environment can be setup.

[Docker Compose](https://docs.docker.com/compose) is an addition to Docker to facilitate
the orchestration (configuration) of one or more Docker 'Containers' (a Container is a running instance of a Docker image)
the orchestration (configuration) of one or more Docker 'Containers' (a container is a running instance of a Docker image)
using a configuration convention (the Docker Compose YAML file), usually named `docker-compose.yml`.

## Docker Installation
Expand Down Expand Up @@ -66,7 +66,7 @@ Some installation notes for different operating systems:

### Mac

* If you are using [Homebrew](https://brew.sh), consider using the [brew Docker formula](https://formulae.brew.sh/formula/Docker)
* If you are using [Homebrew](https://brew.sh), consider using the [brew Docker formula](https://formulae.brew.sh/formula/docker)

### Linux

Expand Down Expand Up @@ -116,10 +116,10 @@ If all goes well, you should be able to run Docker from the command line as foll

```bash
docker --version
# Docker version 28.2.2, build e6534b4
# Docker version 29.4.0, build 9d7ad9f

docker compose version
# Docker Compose version v2.36.2-desktop.1
# Docker Compose version v5.1.1
```

Your version numbers don't have to match those above exactly.
Expand Down Expand Up @@ -150,7 +150,7 @@ Once the containers are downloaded you can test they are running and you can con
and navigate to <http://localhost:7000/>, and you should see the "MapServer Homepage" which means MapServer
is running correctly.

Next we can check that the front-end container is running by opening <http://localhost:7001/points.html>.
Next we will check that the front-end container is running by opening <http://localhost:7001/points.html>.
Hopefully you'll see a map, and we're ready to start the workshop.

## Possible Errors
Expand All @@ -161,5 +161,5 @@ Hopefully you'll see a map, and we're ready to start the workshop.
by another program trying to update Ubuntu. Rebooting may fix this, or you can try running `sudo kill <process_id>` for example in this case `sudo kill 46288`.
* `docker-desktop : Depends: docker-ce-cli but it is not installable` - you are attempting to install Docker Desktop, but have not yet installed the Docker Engine.
* `unable to get image 'node:lts-slim': error during connect: in the default daemon configuration on Windows, the docker client must be
run with elevated privileges to connect: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.50/images/node:lts-slim/json": open //./pipe/docker_engine: The system cannot find the file specified.`
- you will need
run with elevated privileges to connect: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.50/images/node:lts-slim/json": open //./pipe/docker_engine: The system cannot find the file specified.` -
Docker Desktop is not running or the Docker daemon has not started. Start Docker Desktop and wait until it reports that Docker is running. If the problem persists, restart Docker Desktop and run the terminal as Administrator.
2 changes: 2 additions & 0 deletions workshop/exercises/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ First ensure the Docker service is running, then to start Docker Compose,
navigate to the `workshop/exercises` folder and run the following command:

```bash
# change the path below to match your setup
cd D:\GitHub\getting-started-with-mapserver\workshop\exercises
docker compose up -d
```

Expand Down
1 change: 1 addition & 0 deletions workshop/exercises/mapfiles/arcgis.map
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MAP
"init=epsg:4326"
END
WEB
IMAGEPATH "/etc/mapserver/tmp/"
METADATA
"ows_enable_request" "*"
"ows_srs" "EPSG:4326 EPSG:3857"
Expand Down
1 change: 1 addition & 0 deletions workshop/exercises/mapfiles/clusters.map
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MAP
END
FONTSET "data/fonts/fontset.txt"
WEB
IMAGEPATH "/etc/mapserver/tmp/"
METADATA
"ows_enable_request" "*"
"ows_srs" "EPSG:4326 EPSG:3857"
Expand Down
1 change: 1 addition & 0 deletions workshop/exercises/mapfiles/contours.map
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ MAP
END

WEB
IMAGEPATH "/etc/mapserver/tmp/"
METADATA
"ows_enable_request" "*"
"ows_srs" "EPSG:4326 EPSG:3857"
Expand Down
3 changes: 3 additions & 0 deletions workshop/exercises/mapfiles/countries.map
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ MAP
"epsg:4326"
END

WEB
IMAGEPATH "/etc/mapserver/tmp/"
END

# the extent of the map in the projection
EXTENT -180 -90 180 90
Expand Down
1 change: 1 addition & 0 deletions workshop/exercises/mapfiles/gdalg.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MAP
"init=epsg:4326"
END
WEB
IMAGEPATH "/etc/mapserver/tmp/"
METADATA
"ows_enable_request" "*"
"ows_srs" "EPSG:4326 EPSG:3857"
Expand Down
1 change: 1 addition & 0 deletions workshop/exercises/mapfiles/lakes.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MAP
END
FONTSET "data/fonts/fontset.txt"
WEB
IMAGEPATH "/etc/mapserver/tmp/"
METADATA
"ows_enable_request" "*"
"ows_srs" "EPSG:4326 EPSG:3857"
Expand Down
44 changes: 21 additions & 23 deletions workshop/exercises/mapfiles/landuse.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ MAP
"epsg:4326"
END
SYMBOL
NAME 'octahedron'
TYPE VECTOR
POINTS
20 18
22 18
24 20
24 22
22 24
20 24
18 22
18 20
20 18
END
FILLED FALSE
END
NAME "octahedron"
TYPE VECTOR
POINTS
20 18
22 18
24 20
24 22
22 24
20 24
18 22
18 20
20 18
END
FILLED FALSE
END
SYMBOL
NAME "marsh_isom"
TYPE VECTOR
Expand Down Expand Up @@ -166,7 +166,6 @@ MAP
SYMBOL "wetland"
END
END

CLASS
EXPRESSION {park,grass}
STYLE
Expand All @@ -181,19 +180,18 @@ MAP
END
CLASS
EXPRESSION "forest"
STYLE
#COLOR 231 255 170
STYLE
COLOR 34 139 34
END
STYLE
END
STYLE
SYMBOL "tree" # "octahedron"
SIZE 10
COLOR 100 100 100
END
#STYLE
# SYMBOL "paper"
#END
END
#STYLE
# SYMBOL "paper"
#END
#CLASS
# STYLE
# SYMBOL "marsh_isom" # uncrossablemarsh_isom indistinctmarsh_isom marsh_isom
Expand Down
1 change: 1 addition & 0 deletions workshop/exercises/mapfiles/lines.map
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MAP
END

WEB
IMAGEPATH "/etc/mapserver/tmp/"
METADATA
"ows_enable_request" "*"
"ows_srs" "EPSG:4326 EPSG:3857"
Expand Down
Loading