Skip to content

Commit 9eeb316

Browse files
authored
Merge pull request #10 from prushforth/master
Restructure a bit and add a couple of pages of documentation
2 parents 938ac82 + ae4e9bf commit 9eeb316

File tree

10 files changed

+4928
-2061
lines changed

10 files changed

+4928
-2061
lines changed

docs/assets/img/mapml-viewer.png

1.17 MB
Loading

docs/intro.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ title: Introduction
44
slug: /
55
---
66

7-
:::info
8-
Under construction
9-
:::
7+
The web-map custom element suite provides a Web map viewer 'widget' which is modelled somewhat after the HTML5 `<video>` tag: a fairly simple way to get started publishing Web content of the mapping variety. If you're familiar with that HTML `<video>` developer and user experience you may find developing with and using the web-map custom element suite familiar.
8+
9+
For example, markup such as this:
10+
11+
```html
12+
<mapml-viewer projection="CBMTILE" zoom="3" lat="62.7" lon="-90.3" controls>
13+
<layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked></layer->
14+
<layer- label="Restaurants" src="demo/restaurants.mapml" checked></layer->
15+
<layer- label="Canada's Provinces and Territories" src="demo/canada.mapml" checked></layer->
16+
</mapml-viewer>
17+
```
18+
19+
can be used to create a map like this:
20+
21+
![The web-map in action](assets/img/mapml-viewer.png)

docs/maps/mapml-viewer.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
id: mapml-viewer
3+
title: <mapml-viewer>
4+
slug: /maps/mapml-viewer
5+
---
6+
7+
## Introduction
8+
9+
The `<mapml-viewer>` element is the main element you can use to put a custom Web map on your page. To create a (really) simple Web map, you might use it like this:
10+
11+
```html
12+
<!DOCTYPE html>
13+
<html lang="en">
14+
<head>
15+
<meta charset="utf-8" />
16+
<title>A Simple Web Map[tm]</title>
17+
<meta name="viewport" content="width=device-width, initial-scale=1">
18+
<script type="module" src="web-map/mapml-viewer.js"></script>
19+
</head>
20+
<body>
21+
<mapml-viewer projection="OSMTILE" zoom="0" lat="0.0" lon="0.0" controls>
22+
<layer- label="OpenStreetMap" src="https://geogratis.gc.ca/mapml/en/osmtile/osm/" checked></layer->
23+
</mapml-viewer>
24+
</body>
25+
</html>
26+
```
27+
Note that for the above example to run properly on your own site, you need to get a built copy of the `<mapml-viewer>` project in your site's folder. In the example, the `<mapml-viewer>` files are copied into the folder named "web-map" in your site root folder. Your own site's path to these files will depend on how you structure your folders.
28+
29+
`<mapml-viewer>` is an "[autonomous custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements)" in HTML. You can distinguish a custom element of any category from a "native" HTML element by the "-" anywhere in the element name. Autonomous custom elements are supported by all modern browsers, but don't work in old browsers (e.g. Internet Explorer and old Edge).
30+
31+
The `<mapml-viewer>` element has several attributes to control the presentation and initial location of the map.
32+
33+
### Attributes
34+
35+
36+
`projection` - an enumerated attribute. Case-sensitive values are: "`OSMTILE`", "`WGS84`", "`CBMTILE`" and "`APSTILE`".
37+
38+
- `OSMTILE` corresponds to the widely-used "Web Mercator" projected coordinate reference system, implying a "tile pyramid" zoom range from 0 to 23 (minimum tile size ~2.4m).
39+
40+
- `WGS84` provides an implementation of the "pseudo plate carée" projected coordinate reference system, wherein the easting and northing axis units are decimal degrees (not meters). In `WGS84`, zoom level 0 contains two tiles that each cover a hemisphere of Earth's surface. `WGS84` is defined with 21 zoom levels (0 to 20).
41+
42+
- `CBMTILE` is the de facto standard grid layout for the Canadian Geospatial Data Infrastructure (CGDI), defined by Natural Resources Canada, and is based on the Lambert Conformal Conic projection (EPSG:3978). Zoom levels are based on a numeric map scale denominator (e.g. 10000 corresponding to a map scale of 1:10,000), with a particular pixel resolution selected, and as a result, successive zoom levels' tiles do not nest exactly (as they do in `OSMTILE`, `WGS84` and `APSTILE`).
43+
44+
- `APSTILE` is based on the Alaska Polar Stereographic (EPSG:5936) projected coordinate reference system, and has 20 zoom levels (0 to 19).
45+
46+
- other projections are possible, using the "[Custom Projections](https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/8723e4d8bad8e3629bc9dca7a6fe81d724e8418f/demo/CustomProjection.html#L1-L158)" API
47+
48+
`zoom` - a non-negative integer. The value establishes the initial zoom level of the map. For a small scale view of the world, use a lower value. Use larger values for larger scales (smaller area maps). The maximum value depends on the particular `projection` and data source. Many map data sources have limited zoom levels available.
49+
50+
`lat` - a real number latitude. The value establishes the initital latitide of the of the center of the map. Latitudes on Earth range from -90.0 (south) to 90.0 (north). Many projections are not able to display all latitudes, and most projections have a limited range of locations where distortion is controlled or limited. In particular, OSMTILE (Web Mercator) can only display content between the latitude range -84 to 84.
51+
52+
`lon` - a real number longitude. The value establishes the initital longitude of the of the center of the map.Longitudes on Earth range from -180.0 (west) to 180.0 (east). Similar comments related to distortion apply to those for latitude. Be careful, this attribute is named "lon" NOT "long", and if you use "long" your map won't work properly.
53+
54+
`controls` - a "boolean" attribute. Turns map controls on (if present) or off (if omitted). In HTML "boolean" attributes don't have values of "true" or "false" per se - they have the implied value of "true" if the attribute exists, and an implied value of "false" if the attribute is not present. Sometimes the default map controls may not be useful for your map, so you may turn them off and design your own.
55+
56+
`controlslist` - an enumerated attribute, possible values are: "`nofullscreen`", "`nolayer`", "`noreload`" and "`nozoom`". Occasionally, you may not want your users to have access to a particular control, so you may prune the set of controls automatically presented (when you have used the `controls` boolean attribute).

docs/maps/web-map.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
id: web-map
3+
title: <map is="web-map">
4+
slug: /maps/web-map
5+
---
6+
7+
The HTML `<map>` element has been deployed and in use in browsers since the mid-90's. It was used to provide visually appealing yet accessible home pages, by giving the Web developer the ability to design links as invisible yet interactive polygonal areas on top of one or more images. Use of this facility became known as "client side image maps", and was often used to provide site navigation links.
8+
9+
In recent years, client side image maps have fallen out of wide use, due to improvements in other areas of the Web platform. However, some sites still use image maps to provide a simple, accessible, but simultaneously visual user experience.
10+
11+
The web-map custom element suite provides a set of proof-of-concept "[customized built-in](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements)" elements based on `<map>`, `<area>` and `<img>` that will "fall back" to a client side image map in older browsers, or in the absence of JavaScript (scripting disabled).
12+
13+
:::caution
14+
15+
Note that because not all modern Web browsers implement HTML's customized built-in elements, it is not recommended to use this proof-of-concept on a public Web site, as end-user confusion may be the result.
16+
17+
:::
18+
19+
The following markup may work on Chrome and Firefox, although it may take some fine tuning:
20+
21+
```html
22+
<img usemap="#mymap" src="../map1.png" width="700" height="400" alt="Map area">
23+
<map name="mymap" is="web-map" zoom="17" lat="45.398043" lon="-75.70683" controls>
24+
<layer- id="osm" src="https://geogratis.gc.ca/mapml/osmtile/osm/" label="Open Street Map" checked></layer->
25+
<layer- id="marker" label="Marker layer" src="../marker.mapml"></layer->
26+
<area is="map-area" href='http://example.com/marker/' alt="rectangle" coords="255,145,275,190" shape="rect">
27+
<area is="map-area" id="donut" alt="Circle" href='http://example.com/circle/' coords="250,250,25" shape="circle">
28+
<area is="map-area" id="hole" coords="250,250,7" shape="circle">
29+
<area is="map-area" id="rect" href='http://example.com/rectangle/' alt="Rectangle" coords="345,290,415,320" shape="rect">
30+
<area is="map-area" id="poly" href='http://example.com/polygon/' alt="Polygon" coords="392,116,430,100,441,128,405,145" shape="poly">
31+
</map>
32+
```
33+
34+
To experiment with the `web-map` and `map-area` custom elements, you should link your `<script type="module" src="web-map.js"></script>` to the `web-map.js` file that is built by the web-map custom element suite build process.
35+
36+
In theory, if you take steps to provde the fallback markup, a normal (progressive) Web map experience will be had by most users, while those using an older browser or perhaps even Safari may get the "fallback" client side image map experience.
37+
38+
An older example of such a Web map may be found in [this](https://maps4html.org/Web-Map-Custom-Element/blog/progressive-web-maps.html) blog post. Please raise an [issue](https://github.com/Maps4HTML/Web-Map-Custom-Element/issues) if you have comments about how that example works for you.
39+

docs/resources/resources.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
id: resources
3+
title: Resources
4+
slug: /resources/resources
5+
---
6+
7+
:::info
8+
Under construction
9+
:::

docusaurus.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,9 @@ module.exports = {
9797
{
9898
docs: {
9999
sidebarPath: require.resolve('./sidebars.js'),
100-
// Please change this to your repo.
101-
editUrl:
102-
'https://github.com/Maps4HTML/web-map-doc',
103100
},
104101
blog: {
105102
showReadingTime: true,
106-
// Please change this to your repo.
107-
editUrl:
108-
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
109103
},
110104
theme: {
111105
customCss: require.resolve('./src/css/custom.css'),

0 commit comments

Comments
 (0)