Skip to content

Commit 9601fa8

Browse files
committed
Add remove vector examples
1 parent e7d5789 commit 9601fa8

File tree

7 files changed

+169
-9
lines changed

7 files changed

+169
-9
lines changed

workshop/content/docs/inputs/databases.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ by [Kartoza](https://kartoza.com/).
2121
```bash
2222
cd ./getting-started-with-mapserver/workshop/exercises
2323
docker compose down
24-
docker compose -f docker-db-compose.yml up -d
24+
docker compose -f docker-db-compose.yml up -d
25+
# when finished
26+
docker compose -f docker-db-compose.yml down
2527
```
2628

2729

workshop/content/docs/inputs/vector.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,48 @@ The OGR drivers however may be better maintained. For formats which have both na
1212
More information can be found on the [Vector Data Management & Optimization](https://mapserver.org/fr/optimization/vector.html) page in the
1313
MapServer documentation.
1414

15-
## Remote Datasets
15+
<div class="map">
16+
<iframe src="https://geographika.github.io/getting-started-with-mapserver-demo/stars.html"></iframe>
17+
</div>
1618

17-
Already covered access
19+
## Remote Datasets using Virtual File Systems
1820

19-
Access via GitHub - same dataset. Add both to the Mapfile
20-
s3 buckets
21+
GDAL's [Virtual File Systems](https://gdal.org/user/virtual_file_systems.html) can be used to
22+
access data over stored on a network, for example on a server or Amazon S3 bucket.
2123

2224
```scala
23-
# CONNECTION "/vsicurl/https://github.com/MapServer/MapServer-demo/raw/main/data/lakespy2.shp"
24-
CONNECTION "data/itasca/lakespy2.shp"
25+
CONNECTIONTYPE OGR
26+
CONNECTION "/vsicurl/https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/constellations.lines.json"
2527
```
2628

29+
<!--
2730
## Extents
31+
-->
32+
33+
## Code
34+
35+
!!! example
36+
37+
- MapServer request: <http://localhost:5000/?map=/etc/mapserver/stars.map&mode=map&layer=constellations>
38+
- OpenLayers example: <http://localhost:5001/stars.html>
39+
40+
??? JavaScript
41+
42+
``` js
43+
--8<-- "stars.js"
44+
```
45+
46+
??? Mapfile
47+
48+
``` scala
49+
--8<-- "stars.map"
50+
```
51+
52+
## Exercises
53+
54+
TODO
55+
56+
2857

2958

3059

workshop/content/docs/outputs/wms.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ We've been using WMS for the example so far. In this exercise we'll look in more
66

77
## Output Image Formats
88

9-
webp
9+
+ webp
1010

1111

1212
## Exercises
1313

1414
1. If you've read this far you deserve to discover one of MapServer's Easter eggs. Try changing the output format to `&format=image`
1515

16-
https://demo.mapserver.org/cgi-bin/wms?version=1.3.0&request=GetMap&service=WMS&layers=cities&format=image/txt&crs=EPSG%3A4326&exceptions=XML&bbox=-90%2C-180%2C90%2C180&styles=&width=500&height=500&transparent=true
16+
<https://demo.mapserver.org/cgi-bin/wms?version=1.3.0&request=GetMap&service=WMS&layers=cities&format=image/txt&crs=EPSG%3A4326&exceptions=XML&bbox=-90%2C-180%2C90%2C180&styles=&width=500&height=500&transparent=true>

workshop/exercises/app/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h2>Mapfile</h2>
2020
<h2>Inputs</h2>
2121
<ul>
2222
<li><a href="raster.html">Raster</a></li>
23+
<li><a href="stars.html">Stars (Vector)</a></li>
2324
<li><a href="postgis.html">PostGIS (Databases)</a></li>
2425
</ul>
2526
<h2>Outputs</h2>

workshop/exercises/app/js/stars.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import '../css/style.css';
2+
import ImageWMS from 'ol/source/ImageWMS.js';
3+
import Map from 'ol/Map.js';
4+
import View from 'ol/View.js';
5+
import { Image as ImageLayer } from 'ol/layer.js';
6+
import { FullScreen, defaults as defaultControls } from 'ol/control.js';
7+
8+
const mapserverUrl = import.meta.env.VITE_MAPSERVER_BASE_URL;
9+
const mapfilesPath = import.meta.env.VITE_MAPFILES_PATH;
10+
11+
const layers = [
12+
new ImageLayer({
13+
source: new ImageWMS({
14+
url: mapserverUrl + mapfilesPath + 'stars.map&',
15+
params: { 'LAYERS': 'constellations,stars,stars2'},
16+
ratio: 1
17+
}),
18+
}),
19+
];
20+
const map = new Map({
21+
layers: layers,
22+
target: 'map',
23+
controls: defaultControls().extend([
24+
new FullScreen()
25+
]),
26+
view: new View({
27+
projection: 'EPSG:4326',
28+
center: [0, 0],
29+
zoom: 1,
30+
}),
31+
});

workshop/exercises/app/stars.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/x-icon" href="https://openlayers.org/favicon.ico" />
6+
<link rel="stylesheet" href="node_modules/ol/ol.css">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>Stars</title>
9+
</head>
10+
<body>
11+
<div id="map" style="background-color: #000; "></div>
12+
<script type="module" src="./js/stars.js"></script>
13+
</body>
14+
</html>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
MAP
2+
NAME "Stars!"
3+
EXTENT -42.33528830884047 -47.25854720678822 43.404846801027695 24.75957883214916
4+
PROJECTION
5+
"init=epsg:4326"
6+
END
7+
SIZE 400 400
8+
FONTSET "data/fonts/fontset.txt"
9+
SYMBOL
10+
NAME "circle"
11+
TYPE ELLIPSE
12+
FILLED TRUE
13+
POINTS
14+
1 1
15+
END
16+
END
17+
WEB
18+
METADATA
19+
"ows_enable_request" "*"
20+
"ows_srs" "EPSG:4326 EPSG:3857"
21+
END
22+
END
23+
IMAGECOLOR 0 0 0
24+
LAYER
25+
TYPE LINE
26+
PROJECTION
27+
AUTO
28+
END
29+
NAME "constellations"
30+
STATUS OFF
31+
CONNECTIONTYPE OGR
32+
CONNECTION "/vsicurl/https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/constellations.lines.json"
33+
LABELITEM "Id"
34+
CLASS
35+
LABEL
36+
COLOR "#15f4ee"
37+
FONT "LiberationMono"
38+
TYPE TRUETYPE
39+
SIZE 10
40+
POSITION AUTO
41+
PARTIALS FALSE
42+
END
43+
STYLE
44+
COLOR "#15f4ee"
45+
WIDTH 1
46+
END
47+
END
48+
END
49+
LAYER
50+
TYPE POINT
51+
NAME "stars"
52+
STATUS OFF
53+
CONNECTIONTYPE OGR
54+
CONNECTION "/vsicurl/https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/stars.14.json"
55+
PROCESSING "NATIVE_FILTER=mag>12"
56+
COMPOSITE
57+
COMPFILTER "blur(5)"
58+
OPACITY 90
59+
END
60+
CLASS
61+
STYLE
62+
SYMBOL "circle"
63+
COLOR "#ffcd3c"
64+
SIZE [mag]
65+
END
66+
END
67+
END
68+
LAYER
69+
TYPE POINT
70+
NAME "stars2"
71+
STATUS OFF
72+
CONNECTIONTYPE OGR
73+
CONNECTION "/vsicurl/https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/stars.14.json"
74+
PROCESSING "NATIVE_FILTER=mag>10"
75+
CLASS
76+
STYLE
77+
SYMBOL "circle"
78+
COLOR 255 255 255
79+
SIZE 2
80+
END
81+
END
82+
END
83+
END

0 commit comments

Comments
 (0)