> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/powershell-commands/new-udmap.md).

# New-UDMap

New-UDMap creates an interactive map component in PowerShell Universal for displaying markers, lines, and polygons with configurable zoom, center, and controls.

### Synopsis

Interactive maps for displaying markers, lines, and polygons.

### Syntax

```powershell
New-UDMap [[-Id] <String>] [[-Longitude] <Single>] [[-Latitude] <Single>] [[-Zoom] <Int32>] [[-Height] <String>] [[-Width] <String>] [-Content] <Endpoint> [[-ZoomControlPosition] <String>] [[-ScaleControlPosition] <String>] [-Animate] [[-MaxZoom] <Int32>] [<CommonParameters>]
```

### Description

Interactive maps for displaying markers, lines, and polygons.

### Parameters

#### -Id

The ID of the component. It defaults to a random GUID.

```
Required?                    false
Position?                    1
Default value                ([Guid]::NewGuid())
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Longitude

The default longitude of the map.

```
Required?                    false
Position?                    2
Default value                0
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Latitude

The default latitude of the map.

```
Required?                    false
Position?                    3
Default value                0
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Zoom

The default zoom level of the map.

```
Required?                    false
Position?                    4
Default value                0
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Height

The height of the map.

```
Required?                    false
Position?                    5
Default value                500px
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Width

The width of the map.

```
Required?                    false
Position?                    6
Default value                100%
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Content

The script block to call to get the map data.

```
Required?                    true
Position?                    7
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ZoomControlPosition

The zoom control position. Valid values are topright, topleft, bottomright, bottomleft.

```
Required?                    false
Position?                    8
Default value                topright
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ScaleControlPosition

The scale control position. Valid values are topright, topleft, bottomright, bottomleft, hide.

```
Required?                    false
Position?                    9
Default value                bottomleft
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Animate

Animate the map when it is loaded.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -MaxZoom

The maximum zoom level of the map.

```
Required?                    false
Position?                    10
Default value                18
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### Common parameters

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Outputs

### Examples

#### Example 1: Basic map

```powershell
New-UDMap -Content {
    New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
} -Latitude 43.52107 -Longitude -114.31644 -Zoom 13 -Height '25vh' -Id 'map1'
```

This basic map defines a simple base layer using the wmflabs.org tile server. You can use your own custom tile server by specifying a URL. The map is position over Hailey, Idaho.

#### Example 2: Layer Control

```powershell
New-UDMap -Content {
   New-UDMapLayerControl -Content {
        New-UDMapBaseLayer -Name 'Color' -Content {
            New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
        } -Checked
        New-UDMapOverlay -Name 'Marker' -Content {
            New-UDMapMarker -Latitude 51.505 -Longitude -0.09
        } -Checked
        New-UDMapOverlay -Name 'Marker 2' -Content {
            New-UDMapMarker -Latitude 51.555 -Longitude -0.00
        } -Checked
    }
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '25vh' -Id 'map2'
```

You can enable the layer control by using the New-UDMapLayerControl cmdlet. This map defines several layers with components that you can toggle on and off. You can only have one base layer selected as a time. Map overlay layers can toggle on and off.

#### Example 3: Markers with Popup

```powershell
New-UDMap -Content {
   New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
   New-UDMapMarker -Latitude "51.105" -Longitude "-0.09" -Popup (
      New-UDMapPopup -Content {
         New-UDAlert -Text "Hello"
      } -MinWidth 200
   )
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '25vh' -Id 'map3'
```

You can add markers to the map by using the New-UDMapMarker cmdlet.

#### Example 4: Vectors

```powershell
New-UDMap -Content {
   New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
   New-UDMapVectorLayer -Circle -Radius 1000 -Latitude 51.505 -Longitude -0.09 -Color 'red' -FillColor 'blue' -FillOpacity 0.5
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '25vh' -Id 'map4'
```

You can add vectors to the map by using the New-UDMapVectorLayer cmdlet.


---

# 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://docs.devolutions.net/powershell-universal/powershell-commands/new-udmap.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.
