> For the complete documentation index, see [llms.txt](https://dev.pointr.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.pointr.tech/v9/features/indoor-maps/customizations-and-branding/dynamic-poi-styling.md).

# Dynamic POI Styling

This guide explains how to modify the appearance of POI on the map at runtime.

Dynamic POI Styling lets you **change how your existing POIs look and behave** — in real time — without modifying map data or adding an extra layer.

Use it to dynamically **color, re-icon, hide/unhide,** or **overlay POIs** to reflect real-world conditions like room occupancy or equipment status.

**Typical use case:**

> A facility map updates room colors in real time — green for available, red for occupied.

#### Check out this demo video to see what you can do with Dynamic POI Styling

{% embed url="<https://vimeo.com/manage/videos/1125512601>" %}

## **Change POI Color**

You can change the **color**, **opacity**, or **extrusion height** of any POI to reflect its state — for example, make a room **green** when available, **red** when occupied, or **highlight** it when a user clicks a button.

The example below searches all POIs of type **"restrooms"** and changes the fill color.

{% tabs %}
{% tab title="Web" %}

<pre class="language-javascript"><code class="lang-javascript">// Example: Apply a bright yellow style to a specific POI type.
// You can adjust individual properties as needed.

// Search all POIs of type "restrooms"
const restrooms = await pointrWeb
  .getPoiManager()
  .search("restrooms", undefined, "YOUR_SITE_ID")

// Convert the result object to an array
<strong>const restroomsArray = Object.values(restrooms)
</strong>  
// Update the style of each POI
  restroomsArray.forEach(poi => {
    poi.setStyle({
      color: "#fdff00",
      opacity: 1
  });
});

// Apply updated styles to the map
pointrWeb.updateStyleOfPois(restroomsArray);
</code></pre>

{% endtab %}

{% tab title="iOS" %}
**PTRPoiMapStyle initializer attributes**

<table data-header-hidden><thead><tr><th width="246.0625"></th><th></th></tr></thead><tbody><tr><td>poi</td><td>to make changes on that POI</td></tr><tr><td>icon (optional)</td><td>to render POI's icon image</td></tr><tr><td>fillColor (optional)</td><td>to change color of fill and extrusion fill layers</td></tr><tr><td>fillOpacity (optional)</td><td>to change POI's filling opacity (does not apply on extrusion fill layers)</td></tr><tr><td>extrusionHeight (optional)</td><td>to change POI's height in 3D </td></tr></tbody></table>

<pre class="language-swift"><code class="lang-swift">// Example: Apply a bright yellow style to a specific POI type.
// You can adjust individual properties as needed.

// Search for all POIs of type "restrooms"
guard let site = Pointr.shared.siteManager?.site(withInternalIdentifier: "SITE_ID") else { return }
guard let pois = Pointr.shared.poiManager?.pois(for: site, withTypes: ["restrooms"])?.getPoiList() else { return }

// Convert hex color (#FDFF00) to UIColor (light yellow)
let yellowColor = UIColor(red: 0xFD/255.0, green: 0xFF/255.0, blue: 0x00/255.0, alpha: 1.0)
<strong>
</strong>// Build and apply custom styles
let styles = PTRPoiMapStyle(poi: poi,
                    fillColor: yellowColor,
                    fillOpacity: 1.0
                    )

// Apply the style on mapViewController (you can pass multiple styles at once)
mapWidget.mapViewController.setPoisStyles([style])
</code></pre>

{% endtab %}

{% tab title="Android" %}
**PoiMapStyle initializer attributes**

<table data-header-hidden><thead><tr><th width="237.79296875"></th><th></th></tr></thead><tbody><tr><td>poi</td><td>to make changes on that POI</td></tr><tr><td>icon (optional)</td><td>to render POI's icon image</td></tr><tr><td>colorInt (optional)</td><td>to change color of fill and extrusion fill layers</td></tr><tr><td>extrusionHeight (optional)</td><td>to change POI's height in 3D </td></tr><tr><td>fillOpacity (optional)</td><td>to change POI's filling opacity</td></tr></tbody></table>

<pre class="language-kotlin"><code class="lang-kotlin">// Example: Apply a bright yellow style to a specific POI type.
// You can adjust individual properties as needed.
<strong>
</strong>// Search for all POIs of type "restrooms"
val site = Pointr.getPointr()?.siteManager?.getSite("SITE_ID") ?: return
val pois = Pointr.getPointr()?.poiManager?.getPois(site, listOf("restrooms"))?.poiList ?: return
<strong>
</strong><strong>// Define your color (light yellow)
</strong>val yellow = Color.parseColor("#FDFF00")

val style = PoiMapStyle(
    poi= poi
    colorInt = yellow,
    fillOpacity = 1f
    )

// Apply the style on MapFragment (you can pass multiple styles at once)
widget?.mapFragment?.setPoisStyles(listOf(style))
</code></pre>

{% endtab %}
{% endtabs %}

| Default map styling                                                                                                                                                                                                             | Change color to yellow                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FaAiw4FEmAkiLrBbfyLsc%2Ffill-color-before.PNG?alt=media\&token=8b68293f-8383-43df-aa14-4bf248a909ec) | <img src="https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FMdkSixFJVBBC2CpJD3aI%2Ffill-color-after.PNG?alt=media&amp;token=ac8569e4-38a7-4ae5-88a6-eb909c3c0920" alt="" data-size="original"> |

{% hint style="success" %}
Result: Changes fill color to `#FDFF00`
{% endhint %}

## Change POI Icons

{% tabs %}
{% tab title="Web" %}

```javascript
// Example: Change POI icons and color for all "restaurant" POIs

// Search for all POIs of type "restaurant"
const restaurants = await pointrWeb
  .getPoiManager()
  .search("restaurant", undefined, "YOUR_SITE_ID");

// Convert the result object to an array
const restaurantArray = Object.values(restaurants);

// Apply new icon and color
restaurantArray.forEach(poi => {
  poi.setStyle({
    color: "#DEDCD3",   // new fill color
    icon: "https://5493376.fs1.hubspotusercontent-na1.net/hubfs/5493376/Dynamic%20POI%20Styling/chef.png"
  });
});

// Apply the updates to the map
pointrWeb.updatePoiStyles(restaurantArray);
```

{% endtab %}

{% tab title="iOS" %}

<pre class="language-swift"><code class="lang-swift">// Example: Change POI icons and color for all "restaurant" POIs

// Search for all POIs of type "restaurant"
guard let site = Pointr.shared.siteManager?.site(withInternalIdentifier: "SITE_ID") else { return }
guard let pois = Pointr.shared.poiManager?.pois(for: site, withTypes: ["restaurant"])?.getPoiList() else { return }

// Load the custom icon (from bundle or URL)
    let url = "https://5493376.fs1.hubspotusercontent-na1.net/hubfs/5493376/Dynamic%20POI%20Styling/chef.png"
    let chefImage = await fetchImage(url)

// Define the fill color (#DEDCD3)
let greyColor = UIColor(red: 0xDE/255.0, green: 0xDC/255.0, blue: 0xD3/255.0, alpha: 1.0)

<strong>
</strong>// Build and apply custom styles
<strong>let style = PTRPoiMapStyle(poi: poi,
</strong><strong>                    image: chefImage,             // set your icon image
</strong><strong>                    imageName: "chef",           // image name (required)
</strong>                    fillColor: greyColor,       // set color to your POI
                    fillOpacity: 1.0           // fully visible
                    )

// Apply the style on mapViewController (you can pass multiple styles at once)
mapWidget.mapViewController.setPoisStyles([style])
</code></pre>

{% endtab %}

{% tab title="Android" %}

```kotlin
// Example: Change POI icons and color for all "restaurant" POIs

// Search for all POIs of type "restaurant"
val site = Pointr.getPointr()?.siteManager?.getSite("SITE_ID") ?: return
val pois = Pointr.getPointr()?.poiManager?.getPois(site, listOf("restaurant"))?.poiList ?: return

// Define the color (#DEDCD3)
val grey = Color.parseColor("#DEDCD3")

// URL for the chef icon
val chefIconUrl = "https://5493376.fs1.hubspotusercontent-na1.net/hubfs/5493376/Dynamic%20POI%20Styling/chef.png"

// Load the custom icon asynchronously using Glide
Glide.with(context)
    .load(chefIconUrl)
    .into(object : CustomTarget<Drawable>() {
        override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {

// Once the icon is loaded, build the POI style
val style = PoiMapStyle(
    poi= poi,
    icon = resource,            // pass the Drawable, not the URL
    colorInt = grey,            // fill color
    fillOpacity = 1f            // fully visible (0f..1f)
    )

// Apply the style on MapFragment (you can pass multiple styles at once)
widget?.mapFragment?.setPoisStyles(listOf(style))
```

{% endtab %}
{% endtabs %}

| Default map styling                                                                                                                                                                                                                                                  | Change POI icons and color                                                                                                                                                                                                    |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <img src="https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FLWbLmAFnForqJ3dfab2a%2Fpoi-style-before.png?alt=media&amp;token=223d0198-a447-46a6-acf5-f62b644bef74" alt="" data-size="original"> | ![](https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FrSh37nTWWQJYXMSuAKtQ%2Fpoi-style-after.png?alt=media\&token=130fd78f-8cd4-42c6-847c-e43904d5cf07) |

{% hint style="success" %}
**Result:** Replaces default icons with the chef image and changes fill color to `#DEDCD3`
{% endhint %}

## **Hiding and Unhiding POIs**

{% tabs %}
{% tab title="Web" %}

```javascript
// Example: Hide and unhide all POIs with the "booth" type code

// Search for all POIs of type "booth"
const booths = await pointrWeb
  .getPoiManager()
  .search("booth", undefined, "YOUR_SITE_ID");

// Convert the result object into an array
const boothArray = Object.values(booths);

// Hide all booth POIs
pointrWeb.hidePois(boothArray)
```

To make all hidden POIs visible again, use the showAllHiddenPois method:

```javascript
pointrWeb.showAllHiddenPois()
```

{% endtab %}

{% tab title="iOS" %}

```swift
// Example: Hide and unhide all POIs with the "booth" type code

// Search for all POIs of type "booth"
guard let site = Pointr.shared.siteManager?.site(withInternalIdentifier: "SITE_ID") else { return }
guard let pois = Pointr.shared.poiManager?.pois(for: site, withTypes: ["booth"])?.getPoiList() else { return }

// Hide the pois
mapWidget.mapViewController.poisToHide = pois

// Unhide the pois by just setting the property to nil
mapWidget.mapViewController.poisToHide = nil
```

{% endtab %}

{% tab title="Android" %}

```kotlin
// Example: Hide and unhide all POIs with the "booth" type code

// Search for all POIs of type "booth"
val site = Pointr.getPointr()?.siteManager?.getSite("SITE_ID") ?: return
val pois = Pointr.getPointr()?.poiManager?.getPois(site, listOf("booth"))?.poiList ?: return

// Hide the pois
mapWidget.mapFragment.poisToHide = pois

// To unhide just set the property to null
mapWidget.mapFragment.poisToHide = null
```

{% endtab %}
{% endtabs %}

| Hide POIs                                                                                                                                                                                                                    | Unhide POIs                                                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FQ6IyXjxMREgdVJp1Bhos%2Fpoi-hide-after.png?alt=media\&token=f30c6a13-04df-4305-916b-8f40dde26e91) | ![](https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FBhq9PmiY58olYTBoOCxN%2Fpoi-hide-before.png?alt=media\&token=34d6b72f-6257-4af0-8c1a-d99d32d1a5fc) |

{% hint style="success" %}
**Result**: dynamically hides and unhides all POIs with the "booth" type code.
{% endhint %}

## **Reverting Style Changes**

{% tabs %}
{% tab title="Web" %}
To revert all POIs back to their original styles, use the `resetAllPoiStyles` method:&#x20;

```
pointrWeb.resetAllPoiStyles()
```

It's also possible to revert the style of a single POI or multiple pois array with resetPoiStyles :

```javascript
resetPoiStyles(poi) // or resetPoiStyles([poi1, poi2])
```

{% endtab %}

{% tab title="iOS" %}
To revert all POIs back to their original styles, use the `resetStyleForAllPois` method:&#x20;

```swift
mapWidget.mapViewController.resetStyleForAllPois()
```

It's also possible to revert the style of one or more specific POI:

```swift
mapWidget.mapViewController.resetStyleForPois(pois)
```

{% endtab %}

{% tab title="Android" %}
To revert all POIs back to their original styles, use the `resetStyleForAllPois` method:&#x20;

```swift
mapWidget.mapFragment.resetStyleForAllPois()
```

It's also possible to revert the style of one or more specific POI:

```swift
mapWidget.mapFragment.resetStyleForPois(pois)
```

{% endtab %}
{% endtabs %}

| Dynamic POI Styling                                                                                                                                                                                                       | Revert back to default                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FJ1TcsdDq78adX1Vecz04%2Fpoi-dynamic.png?alt=media\&token=1c41a8a6-b5ee-4d5d-ba61-0a1c6778e1af) | ![](https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2FVNVale3u64f2czy3e6Qd%2Fpoi-reverse.png?alt=media\&token=e0cc16de-f92c-4a83-a369-57406632cb8a) |

{% hint style="success" %}
**Result**: revert **all POIs** (or **selected ones**) back to their original default styles.
{% endhint %}

{% hint style="info" %}
**For more details and advanced setup, visit our** [**Mobile SDK reference**](broken://pages/Hlj1A7MkoOUVaSpcCPo7)**.**
{% endhint %}

## Show Overlay on Your Map

To display **overlays** such as cards, clickable pop-ups, markers, custom landmarks, or styles that aren’t part of existing POIs, use **Custom Drawing**.

> **Example**: Add an overlay card to show a room’s status when a user clicks on a POI.

<figure><img src="https://2585032735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjgeYeKrK9Emf57ofXXap%2Fuploads%2F8sgOUbLCfv7j19AbOFfL%2Fimage.png?alt=media&amp;token=3085d079-c554-4f64-935f-b007ad2e1fc5" alt=""><figcaption></figcaption></figure>

### Show availability of meeting rooms on map

Update the poi styles on map to describe the availability of meeting rooms on your map!

Below is the code snippets for both platforms.

{% tabs %}
{% tab title="iOS" %}

```swift
private func createBookedRooms() {
    // List of ids of meeting rooms that are booked
    let poiIdsOfBookedMeetingRooms: [String] = []

    // Search for all POIs of type "meeting-space"
    guard let site = Pointr.shared.siteManager?.site(withInternalIdentifier: "SITE_ID") else { return }
    guard let meetingRoomPois = Pointr.shared.poiManager?.pois(for: site, withTypes: ["meeting-space"])?.getPoiList() else { return }

    // Filter the booked and available meeting rooms using id
    let listOfBookedMeetingRooms = meetingRoomPois.filter { poiIdsOfBookedMeetingRooms.contains($0.identifier) }
    let listOfAvailableMeetingRooms = meetingRoomPois.filter { !poiIdsOfBookedMeetingRooms.contains($0.identifier) }

    // Build styles for booked meeting rooms
    let bookedStyles: [PTRPoiMapStyle] = listOfBookedMeetingRooms.compactMap {
        PTRPoiMapStyle(
            poi: $0,
            image: UIImage(named: "booked_icon"),   // replace with your image asset name
            fillColor: .systemRed
            fillOpacity: 0.8,
            extrusionHeight: 5.0
        )
    }

    // Build styles for available meeting rooms
    let availableStyles: [PTRPoiMapStyle] = listOfAvailableMeetingRooms.compactMap {
        PTRPoiMapStyle(
            poi: $0,
            image: UIImage(named: "available_icon"), // replace with your image asset name
            fillColor: .systemGreen
            fillOpacity: 0.8,
            extrusionHeight: 5.0
        )
    }

    // Apply the styles on mapViewController
    mapWidget.mapViewController.updatePoiStyles(bookedStyles + availableStyles)
}
```

{% endtab %}

{% tab title="Android" %}

```kotlin
  private fun createBookedRooms() {
        val nnContext = context ?: return

        // List of ids of meetings rooms that are booked
        val poiIdsOfBookedMeetingRooms = listOf<String>()

        // Search for all POIs of type "meeting-space"
        val site = Pointr.getPointr()?.siteManager?.getSite("SITE_ID") ?: return
        val meetingRoomPois =  Pointr.getPointr()?.poiManager?.getPois(site, listOf("meeting-space"))?.poiList ?: return

        // Filter the booked and available meetings rooms using id
        val listOfBookedMeetingRooms = meetingRoomPois.filter { it.identifier in poiIdsOfBookedMeetingRooms }
        val listOfAvailableMeetingRooms = meetingRoomPois.filter { it.identifier !in poiIdsOfBookedMeetingRooms }

        Plog.v("- will make ${listOfBookedMeetingRooms.size} rooms booked and ${listOfAvailableMeetingRooms.size} rooms available")

        // Apply the style on MapFragment by mapping the list of pois to PoiMapStyle
        widget?.mapFragment?.updatePoisStyles(listOfBookedMeetingRooms.map {
            // Once the icon is loaded, build the POI style
            PoiMapStyle(
                poi = it,
                // You should change the ids for the drawables with actual drawable resource ids from your project
                icon = ContextCompat.getDrawable(nnContext, R.drawable.booked_icon), // pass the Drawable, not the URL
                // You can change the id of the color resource used here which will be used as the style of the poi extrusion
                colorInt = ContextCompat.getColor(nnContext, R.color.cancel_red), // fill color
                extrusionHeight = 5f,   // height of the extrusion layer
                fillOpacity = 0.8f  // opacity - 0f(not visible)..1f(fully visible)
            )
        })
        // Apply the style on MapFragment by mapping the list of pois to PoiMapStyle
        widget?.mapFragment?.updatePoisStyles(listOfAvailableMeetingRooms.map {
            // Once the icon is loaded, build the POI style
            PoiMapStyle(
                poi = it,
                // You should change the ids for the drawables with actual drawable resource ids from your project
                icon = ContextCompat.getDrawable(nnContext, R.drawable.available_icon),// pass the Drawable, not the URL
                // You can change the id of the color resource used here which will be used as the style of the poi extrusion
                colorInt = ContextCompat.getColor(nnContext, R.color.green), // fill color
                extrusionHeight = 5f, // height of the extrusion layer
                fillOpacity = 0.8f // opacity - 0f(not visible)..1f(fully visible)
            )
        })
    }
```

{% endtab %}
{% endtabs %}

#### 👉 See the [next page](https://dev.pointr.tech/v9/features/indoor-maps/customizations-and-branding/custom-drawings.md) to learn how to create and manage overlays using Custom Drawing.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://dev.pointr.tech/v9/features/indoor-maps/customizations-and-branding/dynamic-poi-styling.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
