Maps4HTML / web-map-doc

Documentation for Web-Map-Custom-Element https://maps4html.org/web-map-doc/
4 stars 10 forks source link

Add new "`<layer->`" menu item under Mapping Elements #32

Closed Malvoz closed 3 years ago

Malvoz commented 3 years ago

New page to describe the <layer-> element, associated attributes, examples, etc.

prushforth commented 3 years ago

I have got something in draft mode locally: map-layer.md, is this what you had in mind?


id: map-layer title: Map Layers slug: /layers/map-layer

Introduction

A key abstraction in the world of mapping is that of "layer". Maps have one or more layers.

The map layer is implemented by the <layer-> custom element.

<layer- label="My Layer" checked>
  ...layer content goes here...
</layer->

<layer-> is not a 'void' element - it must be closed with a </layer-> tag.

Map content can either be inline, as shown above - between the beginning <layer-> and ending </layer-> tags - or fetched, from the <layer- src="..."></layer-> source attribute URL:

<layer- label="My Layer" src="https://example.org/mapml/mylayer" checked></layer->

This documentation uses the convention of inline content mostly. Fetched map content follows similar semantics, except it is parsed with the browser's XML parser and so must follow both MapML document conventions as well as XML syntax rules.

The <layer- checked> attribute and property is boolean. When present, the checked property value is taken to be 'true'; when not present, the property value is 'false'. Beware that it is the presence of the attribute that makes it true, not the value of the attribute. For example, the attribute checked="false" actually turns out to be checked, as described by MDN Web docs.

The label attribute is used by inline content as the displayed text label of the layer in the layer control. In fetched content, the label attribute is ignored, and the fetched <title> element is used.

Malvoz commented 3 years ago

Yes that looks great 👍