Skip to content

Update installation/usage examples for use with CDN #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions docs/api/custom-projections.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For example:
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example Custom Projection</title>
<script type="module" src="web-map/mapml-viewer.js"></script>
<script type="module" src="https://unpkg.com/@maps4html/web-map-custom-element@latest/dist/mapml-viewer.js"></script>
<script type="module">
let customProjectionDefinition = `{
"projection": "ATLAS_POLAR_MAP",
Expand All @@ -39,7 +39,7 @@ For example:
<layer- label="Atlas of Canada Polar Wall Map" checked>
<link rel="license" title="Canadian Federal Geospatial Platform" href="https://geoappext.nrcan.gc.ca/arcgis/rest/services/FGP/NCR_RCN/MapServer/">
<extent units="ATLAS_POLAR_MAP">
<input type="zoom" name="z" min="0" max="6" value="6" >
<input type="zoom" name="z" min="0" max="6" value="6">
<input type="location" name="x" axis="column" units="tilematrix" min="116" max="186">
<input type="location" name="y" axis="row" units="tilematrix" min="125" max="184">
<link rel="tile" tref="https://geoappext.nrcan.gc.ca/arcgis/rest/services/FGP/NCR_RCN/MapServer/tile/{z}/{y}/{x}/">
Expand Down
28 changes: 23 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@ id: installation
title: Installation
---

## Download `<mapml-viewer>` Suite
## Quick start

### Import the `<mapml-viewer>` component

```html
<!-- Import the component from the unpkg CDN -->
<script type="module" src="https://unpkg.com/@maps4html/web-map-custom-element@latest/dist/mapml-viewer.js"></script>

<!-- Use the custom mapping elements in your web pages like any other standard HTML element -->
<mapml-viewer projection="OSMTILE" zoom="0" lat="0.0" lon="0.0" controls>
<layer- label="OpenStreetMap" src="https://geogratis.gc.ca/mapml/en/osmtile/osm/" checked></layer->
</mapml-viewer>
```

---

## Download `<mapml-viewer>` suite

| Version | Description |
|---------|---------------------------------------------|
| [master](https://github.com/Maps4HTML/Web-Map-Custom-Element/archive/master.zip) | Latest version developed on `master` branch, needs to be built, using the [steps to clone the repository](/web-map-doc/docs/installation#clone-mapml-viewer-repository) |
| [v0.8.0](https://github.com/Maps4HTML/Web-Map-Custom-Element/archive/v0.8.0.zip) | Latest zip release |

### Using a Downloaded Version
### Using a downloaded version

#### Extract the zip file

Expand All @@ -28,7 +44,7 @@ Extract the zip file downloaded from the links above, in there you will find man
- proj4-src.js
- proj4leaflet.js

#### Add the Script to a Web page
#### Add the script to a Web page

Copy/move these files to your webpage's directory and add the following to the `<head>` of your HTML code:

Expand All @@ -38,7 +54,9 @@ Copy/move these files to your webpage's directory and add the following to the `

You can now use `<mapml-viewer>`, `<layer->` and the other elements that come in the `<mapml-viewer>` element suite on your webpages.

## Clone `<mapml-viewer>` Repository
---

## Clone `<mapml-viewer>` repository

An alternative to downloading the .zip file is to clone the github repository. This option allows you to make any modifications and view the source code more easily.

Expand All @@ -60,4 +78,4 @@ grunt clean copy rollup #builds mapml
```

After the build is complete a `dist` folder will be created with the contents.
See [Add the Script to a Web page](/web-map-doc/docs/installation#add-the-script-to-a-web-page) on how to use the contents.
See [Add the script to a Web page](/web-map-doc/docs/installation#add-the-script-to-a-web-page) on how to use the contents.
3 changes: 1 addition & 2 deletions docs/maps/mapml-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The `<mapml-viewer>` element is the main element you can use to put a custom Web
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A Simple Web Map[tm]</title>
<script type="module" src="web-map/mapml-viewer.js"></script>
<script type="module" src="https://unpkg.com/@maps4html/web-map-custom-element@latest/dist/mapml-viewer.js"></script>
<style>
html, body {
height: 100%; /* These styles are required if you wish to use a % based
Expand All @@ -28,7 +28,6 @@ The `<mapml-viewer>` element is the main element you can use to put a custom Web
</body>
</html>
```
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.

`<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).

Expand Down
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
},
{
label: 'Installation',
to: 'docs/installation/',
to: 'docs/installation',
},
],
},
Expand Down