You can use the Map Management API to programmatically manage your
cloud-based maps styling resources across both the `v2alpha`
(Experimental) and `v2beta` (Preview) endpoints.

## Summary of operations

To visualize a custom map with the Map Management API, follow these key steps:

1. **Create a StyleConfig**: Define your map's visual appearance using a JSON representation of colors, visibility, and density settings.
2. **Create a MapConfig**: Establish a unique Map ID that acts as the container for your map's identity and high-level features.
3. **Associate them with a MapContextConfig** : Link your `StyleConfig` (and optional datasets) to specific map variants (like `ROADMAP` or `SATELLITE`) within your `MapConfig`.

## Default Behaviors

When using the v2 endpoints, keep the following default behaviors in mind:

- **Map Type** : The default map rendering type is `RASTER`. To use vector-based maps, you must explicitly set the `map_type` to `VECTOR` in your `MapConfig`.
- **Map Variant** : If no `map_variants` are specified when creating a `MapContextConfig`, the configuration will be applied only to the `ROADMAP` variant by default.
- **Base Styling** : If a `json_style_sheet` is empty or not provided in a `StyleConfig`, the default unstyled Google Base map will be used.

## Working with StyleConfigs

A `StyleConfig` contains the JSON-based styling definitions.

### Create a StyleConfig

```
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json" \
https://mapmanagement.googleapis.com/v2beta/projects/YOUR_PROJECT_ID/styleConfigs \
-d '{
  "display_name": "My Custom Style",
  "json_style_sheet": "[{\"featureType\":\"all\",\"stylers\":[{\"saturation\":-100}]}]"
}'
```

### List StyleConfigs

```
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
https://mapmanagement.googleapis.com/v2beta/projects/YOUR_PROJECT_ID/styleConfigs
```

## Working with MapConfigs

A `MapConfig` defines the identity and core rendering type of a map.

### Create a MapConfig

```
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json" \
https://mapmanagement.googleapis.com/v2beta/projects/YOUR_PROJECT_ID/mapConfigs \
-d '{
  "display_name": "My New Map",
  "map_type": "VECTOR"
}'
```

## Working with MapContextConfigs

A `MapContextConfig` links styling to a `MapConfig`.

### Create a MapContextConfig

```
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json" \
https://mapmanagement.googleapis.com/v2beta/projects/YOUR_PROJECT_ID/mapConfigs/YOUR_MAP_ID/mapContextConfigs \
-d '{
  "style_config": "projects/YOUR_PROJECT_ID/styleConfigs/YOUR_STYLE_ID",
  "map_variants": ["ROADMAP", "NAVIGATION"]
}'
```

## Errors

- **PERMISSION_DENIED**: The request lacks sufficient IAM permissions or the project does not have the API enabled.
- **NOT_FOUND**: The specified resource (Project, MapConfig, or StyleConfig) does not exist.
- **INVALID_ARGUMENT**: The request body is malformed or contains invalid field values.