> For the complete documentation index, see [llms.txt](https://help.maphubs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.maphubs.com/advanced/changing-polygon-fill-patterns.md).

# Changing Polygon Fill Patterns

### Option 1: Changing the fill transparency

In the More Colors panel you can reduce the transparency of the fill using the slider or by changing the alpha (A) value

![](/files/-LsK5yOH6IUY_WZZ-lwW)

### Option 2: Only show the outline

In the *Advanced* panel of the layer style settings choose *Outline Only*

![Fill Outline Only Option](/files/-LsIqYs_WPqzk2XwJnw8)

### Option 3: Using a Pattern Fill

![Pattern Fill Example Map](/files/-LsJiCWrUpEOA05VnJmg)

{% hint style="warning" %}
This requires using the [Advanced Map Style Code](/advanced/editing-map-style-code-advanced.md) to edit the underlying Mapbox GL style.
{% endhint %}

Update the  fill layer to change the fill to a pattern instead of a solid color:

1\) to add the `maphubs:images` section to the `metadata` This defines a small image, in this case an SVG vector icon of a stripe pattern, that will be repeated to create the fill.

2\) to add the `pattern-fill` to the `paint` section with the name of the image you created above

```javascript
{
      "id": "polygon-stripes-example",
      "type": "fill",
      "metadata": {
        "maphubs:layer_id": 1,
        "maphubs:globalid": "abc123",
        "maphubs:interactive": true,
        "maphubs:showBehindBaseMapLabels": false,
        "maphubs:images": [
          {
            "name": "stripes",
            "width": 8,
            "height": 8,
            "svg": "<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><rect width='10' height='10' fill-opacity='0' /><path d='M-1,1 l2,-2 M0,10 l10,-10 M9,11 l2,-2' stroke='black' stroke-width='1'/></svg>"
          }
        ],
        "maphubs:outline-only": false
      },
      "source": "polygon-stripes-example",
      "source-layer": "data",
      "filter": [
        "in",
        "$type",
        "Polygon"
      ],
      "paint": {
        "fill-pattern": "stripes",
        "fill-opacity": 0.7
      }
    },
```

If you want to change the color or size of the stripes you can change the `stroke` or `stroke-width` in the `path` element of the SVG icon

#### &#x20;Updating the Legend

After you've set a stripe fill you'll want to update legend. Here is an example showing the stripe pattern from the example above.

```markup
<div class="omh-legend">
 <div class="block" style="background-image: url(&quot;data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMCcgaGVpZ2h0PScxMCc+PHJlY3Qgd2lkdGg9JzEwJyBoZWlnaHQ9JzEwJyBmaWxsLW9wYWNpdHk9JzAnIC8+PHBhdGggZD0nTS0xLDEgbDIsLTIgTTAsMTAgbDEwLC0xMCBNOSwxMSBsMiwtMicgc3Ryb2tlPSdibGFjaycgc3Ryb2tlLXdpZHRoPScxJy8+PC9zdmc+&quot;); background-repeat: repeat;" ></div>
 <h3>{NAME}</h3>
 </div>
```

If you change the SVG for the image you'll need to base64 encode the SVG and replace the encoded value after `image/svg+xml;base64,` in the legend html. Paste your SVG into a tool like <https://www.base64encode.org/> to get the encoded value.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.maphubs.com/advanced/changing-polygon-fill-patterns.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
