diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96d5b6e..cf3ce4a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,26 +1,34 @@ -name: Test documentation ⚙️ - -on: - pull_request: - paths: - - 'workshop/content/**' - -defaults: - run: - working-directory: workshop/content - -jobs: - build: - name: Test documentation build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 - with: - python-version: '3.x' - - name: Install requirements 📦 - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Deploy 📦 - run: zensical build --clean --strict +name: Test documentation and Mapfiles ⚙️ + +on: + pull_request: + paths: + - 'workshop/content/**' + - 'workshop/exercises/mapfiles/**' + +defaults: + run: + working-directory: workshop + +jobs: + build: + name: Test documentation build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.x' + - name: Test Mapfiles + run: | + pip install mappyfile + mappyfile validate exercises/mapfiles/*.map + - name: Install doc requirements 📦 + run: | + cd content + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Deploy 📦 + run: | + cd content + zensical build --clean --strict diff --git a/docker/Dockerfile b/docker/Dockerfile index c529b74..cff9fbc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/osgeo/gdal:ubuntu-full-3.12.2 AS gdal +FROM ghcr.io/osgeo/gdal:ubuntu-full-3.13.1 AS gdal # see https://github.com/OSGeo/gdal/tree/master/docker#ubuntu-based FROM gdal AS builder @@ -73,15 +73,19 @@ RUN cmake .. \ -DWITH_CAIRO=1 \ -DWITH_RSVG=1 \ -DUSE_PROJ=1 \ + -DPROJ_INCLUDE_DIR=/usr/local/gdal-internal/include \ + -DPROJ_LIBRARY=/usr/local/gdal-internal/lib/libinternalproj.so \ -DUSE_WFS_SVR=1 \ -DUSE_OGCAPI_SVR=1 \ -DWITH_ORACLESPATIAL=0 \ -DWITH_PYTHON=1 \ -DWITH_MSSQL2008=0 +# Run the make command for pythonmapscript-wheel RUN cmake --build . --target pythonmapscript-wheel RUN ninja install + FROM gdal AS runner LABEL maintainer="sethg@geographika.co.uk" SHELL ["/bin/bash", "-o", "pipefail", "-cux"] diff --git a/docker/ReadMe.md b/docker/ReadMe.md index 6f59450..79df47f 100644 --- a/docker/ReadMe.md +++ b/docker/ReadMe.md @@ -13,24 +13,18 @@ start "C:\Program Files\Docker\Docker\Docker Desktop.exe" cd D:\GitHub\getting-started-with-mapserver\docker -docker build ` - --tag "mapserver-workshop" ` - --target=runner ` - --build-arg=MAPSERVER_BRANCH=main ` - --build-arg=MAPSERVER_REPO=https://github.com/mapserver/mapserver ` - . +# MAPSERVER_BRANCH=main +# MAPSERVER_BRANCH=branch-8-6 # add --no-cache to the command below to force getting the latest code + docker build ` --tag "mapserver-workshop" ` --target=runner ` --build-arg=MAPSERVER_BRANCH=main ` --build-arg=MAPSERVER_REPO=https://github.com/mapserver/mapserver ` - --no-cache ` . -# docker run -it --name mapserver-workshop -p 8080:8080 mapserver-workshop - docker tag mapserver-workshop geographika/mapserver-workshop # docker login # geographika @@ -49,8 +43,13 @@ Also check https://status.canonical.com/ ## Testing ``` +docker pull geographika/mapserver-workshop:latest +# docker stop mapserver-workshop +# docker rm mapserver-workshop +docker run -it --name mapserver-workshop geographika/mapserver-workshop:latest bash docker start mapserver-workshop docker exec -it mapserver-workshop bash +# mapserv -v ``` ## Build the Demo Image diff --git a/workshop/content/docs/inputs/databases.md b/workshop/content/docs/inputs/databases.md index 3ac85c9..e5dce50 100644 --- a/workshop/content/docs/inputs/databases.md +++ b/workshop/content/docs/inputs/databases.md @@ -60,9 +60,9 @@ docker exec -it mapserver2 bash # navigate to the folder containing the OSM FlatGeobuf files cd /etc/mapserver/data/osm # import the water polygons dataset to the Postgres database in the Postgres Docker image -ogr2ogr -f "PostgreSQL" PG:"dbname=gis user=docker password=docker host=db port=5432" -nln water_a water_a.fgb +gdal vector convert water_a.fgb PG:"dbname=gis user=docker password=docker host=db port=5432" --output-layer water_a --overwrite # now check the data details in the database -ogrinfo PG:"host=db user=docker password=docker dbname=gis port=5432" water_a -summary +gdal vector info PG:"host=db user=docker password=docker dbname=gis port=5432" --layer water_a --summary ``` ## Code diff --git a/workshop/exercises/docker-db-compose.yml b/workshop/exercises/docker-db-compose.yml index 00c2478..b451598 100644 --- a/workshop/exercises/docker-db-compose.yml +++ b/workshop/exercises/docker-db-compose.yml @@ -29,10 +29,10 @@ services: mapserver: - image: camptocamp/mapserver:8.4-gdal3.10 + image: geographika/mapserver-workshop:latest container_name: mapserver2 ports: - - 7000:80 + - 7000:8080 environment: MAPSERVER_CONFIG_FILE: "/etc/mapserver/mapserver.conf" volumes: @@ -56,7 +56,7 @@ services: # from https://github.com/kartoza/docker-postgis/blob/develop/docker-compose.yml db: - image: kartoza/postgis:17-3.5 + image: kartoza/postgis:18-3.6 container_name: db volumes: - ./postgis-data:/var/lib/postgresql diff --git a/workshop/exercises/mapfiles/arcgis.map b/workshop/exercises/mapfiles/arcgis.map index b04341b..408bc5d 100644 --- a/workshop/exercises/mapfiles/arcgis.map +++ b/workshop/exercises/mapfiles/arcgis.map @@ -1,61 +1,61 @@ -MAP - NAME "arcgis" - EXTENT -117.462057 33.895445 -117.436808 33.911090 - SIZE 400 400 - PROJECTION - "init=epsg:4326" - END - WEB - METADATA - "ows_enable_request" "*" - "ows_srs" "EPSG:4326 EPSG:3857" - END - END - LAYER - NAME "PoolPermits" - TYPE POLYGON - PROJECTION - "init=epsg:3857" - END - CONNECTIONTYPE OGR - CONNECTION "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0/query?f=pjson" - PROCESSING "RENDERMODE=ALL_MATCHING_CLASSES" - CLASS - STYLE - COLOR 0 173 181 - OUTLINECOLOR 230 230 230 - OUTLINEWIDTH 0.1 - END - END - CLASS - VALIDATION - labels '.' - default_labels 'hidden' - END - EXPRESSION ('%labels%' = 'visible') - LABEL - TEXT "[apn]" - COLOR 220 240 255 - SIZE 8 - END - END - END - - # this layer is used for the excercise only - not in the arcgis.html page - LAYER - NAME "PoolPermitLabels" - TYPE POLYGON - PROJECTION - "init=epsg:3857" - END - CONNECTIONTYPE OGR - CONNECTION "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0/query?f=pjson" - CLASS - LABEL - TEXT "[apn]" - COLOR 220 240 255 - SIZE 8 - END - END - END -END +MAP + NAME "arcgis" + EXTENT -117.462057 33.895445 -117.436808 33.911090 + SIZE 400 400 + PROJECTION + "init=epsg:4326" + END + WEB + METADATA + "ows_enable_request" "*" + "ows_srs" "EPSG:4326 EPSG:3857" + END + END + LAYER + NAME "PoolPermits" + TYPE POLYGON + PROJECTION + "init=epsg:3857" + END + CONNECTIONTYPE OGR + CONNECTION "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0/query?f=pjson" + PROCESSING "RENDERMODE=ALL_MATCHING_CLASSES" + CLASS + STYLE + COLOR 0 173 181 + OUTLINECOLOR 230 230 230 + OUTLINEWIDTH 0.1 + END + END + CLASS + VALIDATION + labels '.' + default_labels 'hidden' + END + EXPRESSION ('%labels%' = 'visible') + LABEL + TEXT "[apn]" + COLOR 220 240 255 + SIZE 8 + END + END + END + + # this layer is used for the excercise only - not in the arcgis.html page + LAYER + NAME "PoolPermitLabels" + TYPE POLYGON + PROJECTION + "init=epsg:3857" + END + CONNECTIONTYPE OGR + CONNECTION "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0/query?f=pjson" + CLASS + LABEL + TEXT "[apn]" + COLOR 220 240 255 + SIZE 8 + END + END + END +END diff --git a/workshop/exercises/mapfiles/clusters.map b/workshop/exercises/mapfiles/clusters.map index 07c3e5a..5efad04 100644 --- a/workshop/exercises/mapfiles/clusters.map +++ b/workshop/exercises/mapfiles/clusters.map @@ -4,7 +4,7 @@ MAP UNITS DD SIZE 800 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END FONTSET "data/fonts/fontset.txt" WEB diff --git a/workshop/exercises/mapfiles/contours.map b/workshop/exercises/mapfiles/contours.map index 9d490f2..370f666 100644 --- a/workshop/exercises/mapfiles/contours.map +++ b/workshop/exercises/mapfiles/contours.map @@ -7,7 +7,7 @@ MAP IMAGETYPE PNG24 PROJECTION - "init=epsg:4326" + "epsg:4326" END WEB diff --git a/workshop/exercises/mapfiles/countries.map b/workshop/exercises/mapfiles/countries.map index 640deda..4cb92f4 100644 --- a/workshop/exercises/mapfiles/countries.map +++ b/workshop/exercises/mapfiles/countries.map @@ -8,7 +8,7 @@ MAP # the projection used for the map PROJECTION - "init=epsg:4326" + "epsg:4326" END diff --git a/workshop/exercises/mapfiles/data/icons/tree.svg b/workshop/exercises/mapfiles/data/icons/tree.svg index 1ee9fd0..abe73cb 100644 --- a/workshop/exercises/mapfiles/data/icons/tree.svg +++ b/workshop/exercises/mapfiles/data/icons/tree.svg @@ -1,23 +1,23 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/workshop/exercises/mapfiles/lakes.map b/workshop/exercises/mapfiles/lakes.map index 546d02f..570ed3a 100644 --- a/workshop/exercises/mapfiles/lakes.map +++ b/workshop/exercises/mapfiles/lakes.map @@ -3,9 +3,9 @@ MAP EXTENT 393234.3937012631 5208170.531190613 495403.1713263091 5303964.876754144 SIZE 800 600 PROJECTION - "init=epsg:26915" + "epsg:26915" END - FONTSET "data/fonts/fontset.txt" + FONTSET "data/fonts/fontset.txt" WEB METADATA "ows_enable_request" "*" diff --git a/workshop/exercises/mapfiles/landuse.map b/workshop/exercises/mapfiles/landuse.map index 7a184ce..ced2d59 100644 --- a/workshop/exercises/mapfiles/landuse.map +++ b/workshop/exercises/mapfiles/landuse.map @@ -4,24 +4,24 @@ MAP UNITS DD SIZE 800 600 PROJECTION - "init=epsg:4326" + "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 + 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 SYMBOL NAME "marsh_isom" TYPE VECTOR @@ -181,17 +181,15 @@ END END CLASS EXPRESSION "forest" - - STYLE - #COLOR 231 255 170 - COLOR 34 139 34 - END - STYLE - SYMBOL "tree" # "octahedron" - SIZE 10 - COLOR 100 100 100 - END - + STYLE + #COLOR 231 255 170 + COLOR 34 139 34 + END + STYLE + SYMBOL "tree" # "octahedron" + SIZE 10 + COLOR 100 100 100 + END #STYLE # SYMBOL "paper" #END diff --git a/workshop/exercises/mapfiles/lines.map b/workshop/exercises/mapfiles/lines.map index 4033c38..d2b0c48 100644 --- a/workshop/exercises/mapfiles/lines.map +++ b/workshop/exercises/mapfiles/lines.map @@ -4,7 +4,7 @@ MAP SIZE 800 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END WEB diff --git a/workshop/exercises/mapfiles/mapserver.conf b/workshop/exercises/mapfiles/mapserver.conf index 3dea138..77e1d53 100644 --- a/workshop/exercises/mapfiles/mapserver.conf +++ b/workshop/exercises/mapfiles/mapserver.conf @@ -7,6 +7,9 @@ CONFIG # Environment variables (see https://mapserver.org/environment_variables.html) # ENV + + MS_ONLINERESOURCE "/" + # # Limit Mapfile Access # diff --git a/workshop/exercises/mapfiles/ogcapi-features.map b/workshop/exercises/mapfiles/ogcapi-features.map index 6767f03..79f7aa2 100644 --- a/workshop/exercises/mapfiles/ogcapi-features.map +++ b/workshop/exercises/mapfiles/ogcapi-features.map @@ -5,17 +5,18 @@ MAP SIZE 600 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END WEB METADATA "ows_title" "OSM Features" - "ows_enable_request" "*" # this enables all OGC requests + # "ows_enable_request" "*" # this enables all OGC requests "ows_srs" "EPSG:4326 EPSG:3857" "oga_onlineresource" "/ogcapi-features/ogcapi" # "oga_html_template_directory" - # "oga_enable_request" "*" + "oga_enable_request" "*" + "ms_enable_modes" "!*" # disable CGI modes END END diff --git a/workshop/exercises/mapfiles/points.map b/workshop/exercises/mapfiles/points.map index 552b9c2..70e1e30 100644 --- a/workshop/exercises/mapfiles/points.map +++ b/workshop/exercises/mapfiles/points.map @@ -3,7 +3,7 @@ MAP EXTENT 17.77 43.31 17.83 43.36 SIZE 800 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END FONTSET "data/fonts/fontset.txt" WEB diff --git a/workshop/exercises/mapfiles/polygons.map b/workshop/exercises/mapfiles/polygons.map index 627cfdc..c60c589 100644 --- a/workshop/exercises/mapfiles/polygons.map +++ b/workshop/exercises/mapfiles/polygons.map @@ -4,13 +4,13 @@ MAP UNITS DD SIZE 800 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END WEB METADATA - "ows_title" "OSM Buildings" - "ows_enable_request" "*" - "ows_srs" "EPSG:4326 EPSG:3857" + "ows_title" "OSM Buildings" + "ows_enable_request" "*" + "ows_srs" "EPSG:4326 EPSG:3857" END END LAYER diff --git a/workshop/exercises/mapfiles/postgis.map b/workshop/exercises/mapfiles/postgis.map index fda1fb1..19cd16e 100644 --- a/workshop/exercises/mapfiles/postgis.map +++ b/workshop/exercises/mapfiles/postgis.map @@ -5,7 +5,7 @@ MAP SIZE 800 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END WEB diff --git a/workshop/exercises/mapfiles/railways.map b/workshop/exercises/mapfiles/railways.map index 5617b74..2ac13c4 100644 --- a/workshop/exercises/mapfiles/railways.map +++ b/workshop/exercises/mapfiles/railways.map @@ -4,7 +4,7 @@ MAP UNITS DD SIZE 800 600 PROJECTION - "init=epsg:4326" + "epsg:4326" END SYMBOL NAME "vertline" # we can use this to reference the SYMBOL in STYLEs @@ -100,6 +100,5 @@ MAP SIZE 18 END END - END END END \ No newline at end of file diff --git a/workshop/exercises/mapfiles/raster.map b/workshop/exercises/mapfiles/raster.map index 94e663c..8b6f994 100644 --- a/workshop/exercises/mapfiles/raster.map +++ b/workshop/exercises/mapfiles/raster.map @@ -7,7 +7,7 @@ MAP IMAGETYPE PNG24 PROJECTION - "init=epsg:4326" + "epsg:4326" END WEB diff --git a/workshop/exercises/mapfiles/sld.map b/workshop/exercises/mapfiles/sld.map index 544a2a0..242389a 100644 --- a/workshop/exercises/mapfiles/sld.map +++ b/workshop/exercises/mapfiles/sld.map @@ -3,8 +3,8 @@ MAP EXTENT -20037508.34 -20048966.1 20037508.34 20048966.1 #EXTENT -180 -90 180 90 PROJECTION - #"init=epsg:4326" - "init=epsg:3857" + #"epsg:4326" + "epsg:3857" END WEB METADATA @@ -26,7 +26,7 @@ MAP DEBUG 5 TYPE POLYGON PROJECTION - "init=epsg:4326" + "epsg:4326" END STATUS ON @@ -53,7 +53,7 @@ MAP # NAME "cities" # TYPE POINT # PROJECTION - # "init=epsg:4326" + # "epsg:4326" # END # STATUS ON # CONNECTIONTYPE OGR diff --git a/workshop/exercises/mapfiles/stac.map b/workshop/exercises/mapfiles/stac.map index bdf02ab..d5bc4d5 100644 --- a/workshop/exercises/mapfiles/stac.map +++ b/workshop/exercises/mapfiles/stac.map @@ -1,51 +1,51 @@ -MAP - NAME "STAC" - EXTENT -180 -90 180 90 - UNITS DD - SIZE 600 600 - PROJECTION - "init=epsg:4326" - END - WEB - METADATA - "ows_enable_request" "*" - "ows_srs" "EPSG:4326 EPSG:3857 EPSG:5070" - END - VALIDATION - # check the parameter is in the form -74.134,41.871,-73.694,42.089 - BBOX '^-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)?$' - END - END - - LAYER - NAME "lcpri" - TYPE RASTER - DATA 'STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?&collections=usgs-lcmap-conus-v13&datetime=2021-01-01/2021-12-31&bbox=%BBOX%\":asset=lcpri' - PROJECTION - "init=epsg:5070" - END - PROCESSING "BANDS=1" - CLASS - EXPRESSION ([pixel] = 5) - STYLE - COLOR 28 107 160 - END - END - - CLASS - EXPRESSION ([pixel] != 5) - STYLE - COLORRANGE 255 255 230 0 100 0 # light green to dark green - DATARANGE 1 8 - END - END - - # to switch to black and white uncomment below - - # PROCESSING "SCALE=1,8" - # PROCESSING "SCALE_BUCKETS=256" - # PROCESSING "CLASSIFY_SCALED=TRUE" - - END - +MAP + NAME "STAC" + EXTENT -180 -90 180 90 + UNITS DD + SIZE 600 600 + PROJECTION + "init=epsg:4326" + END + WEB + METADATA + "ows_enable_request" "*" + "ows_srs" "EPSG:4326 EPSG:3857 EPSG:5070" + END + VALIDATION + # check the parameter is in the form -74.134,41.871,-73.694,42.089 + BBOX '^-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)?,-?\d+(?:\.\d+)?$' + END + END + + LAYER + NAME "lcpri" + TYPE RASTER + DATA 'STACIT:\"https://planetarycomputer.microsoft.com/api/stac/v1/search?&collections=usgs-lcmap-conus-v13&datetime=2021-01-01/2021-12-31&bbox=%BBOX%\":asset=lcpri' + PROJECTION + "init=epsg:5070" + END + PROCESSING "BANDS=1" + CLASS + EXPRESSION ([pixel] = 5) + STYLE + COLOR 28 107 160 + END + END + + CLASS + EXPRESSION ([pixel] != 5) + STYLE + COLORRANGE 255 255 230 0 100 0 # light green to dark green + DATARANGE 1 8 + END + END + + # to switch to black and white uncomment below + + # PROCESSING "SCALE=1,8" + # PROCESSING "SCALE_BUCKETS=256" + # PROCESSING "CLASSIFY_SCALED=TRUE" + + END + END \ No newline at end of file diff --git a/workshop/exercises/mapfiles/stars.map b/workshop/exercises/mapfiles/stars.map index 3e7e763..15b485f 100644 --- a/workshop/exercises/mapfiles/stars.map +++ b/workshop/exercises/mapfiles/stars.map @@ -2,7 +2,7 @@ MAP NAME "Stars!" EXTENT -42.33528830884047 -47.25854720678822 43.404846801027695 24.75957883214916 PROJECTION - "init=epsg:4326" + "epsg:4326" END SIZE 400 400 FONTSET "data/fonts/fontset.txt" diff --git a/workshop/exercises/mapfiles/tiles.map b/workshop/exercises/mapfiles/tiles.map index f54e91c..e7662d2 100644 --- a/workshop/exercises/mapfiles/tiles.map +++ b/workshop/exercises/mapfiles/tiles.map @@ -2,7 +2,7 @@ MAP NAME "Tiles" EXTENT -20037508.34 -20048966.1 20037508.34 20048966.1 PROJECTION - "init=epsg:3857" + "epsg:3857" END SIZE 256 256 WEB @@ -20,7 +20,7 @@ MAP DATA "data/naturalearth/ne_110m_admin_0_countries.fgb" EXTENT -180.0 -90.0 180.0 90 PROJECTION - "init=epsg:4326" + "epsg:4326" END CLASS STYLE diff --git a/workshop/exercises/mapfiles/vector-tiles.map b/workshop/exercises/mapfiles/vector-tiles.map index 01a7785..fe7869c 100644 --- a/workshop/exercises/mapfiles/vector-tiles.map +++ b/workshop/exercises/mapfiles/vector-tiles.map @@ -3,13 +3,13 @@ MAP EXTENT -20037508.34 -20048966.1 20037508.34 20048966.1 SIZE 256 256 PROJECTION - "init=epsg:3857" + "epsg:3857" END LAYER NAME "countries" TYPE POLYGON PROJECTION - "init=epsg:4326" + "epsg:4326" END EXTENT -180.0 -90.0 180.0 90 STATUS OFF diff --git a/workshop/exercises/mapfiles/wfs.map b/workshop/exercises/mapfiles/wfs.map index f1d351a..0945f14 100644 --- a/workshop/exercises/mapfiles/wfs.map +++ b/workshop/exercises/mapfiles/wfs.map @@ -3,7 +3,7 @@ MAP EXTENT -180 -90 180 90 SIZE 400 400 # PROJECTION - "init=epsg:4326" + "epsg:4326" END OUTPUTFORMAT @@ -28,7 +28,7 @@ MAP NAME "places" TYPE POINT PROJECTION - "init=epsg:4326" + "epsg:4326" END EXTENT -180.0 -90.0 180.0 90 STATUS OFF