# Class: MapModel

## MapModel()

The Map Model contains all of the settings and options for a required to render a map view.

## Constructor

####
new MapModel()

Since:
  - 2.18.0
Source:
  - src/js/models/maps/Map.js, line 20

### Extends

- Backbone.Model

### Members

####
defaults :Object

Overrides the default Backbone.Model.defaults() function to specify default attributes for the Map

##### Type:

- Object

##### Properties:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`homePosition` | MapConfig#CameraPosition | <optional> | {longitude: -65, latitude: 56, height: 10000000, heading: 1, pitch: -90, roll: 0} | A set of coordinates that give the (3D) starting point of the Viewer. This position is also where the "home" button in the Cesium viewer will navigate to when clicked.
`terrains` | MapAssets | <optional> | new MapAssets() | The terrain options to show in the map.
`layers` | MapAssets | <optional> | new MapAssets() | The imagery and vector data to render in the map.
`selectedFeatures` | Features | <optional> | new Features() | Particular features from one or more layers that are highlighted/selected on the map. The 'selectedFeatures' attribute is updated by the map widget (cesium) with a Feature model when a user selects a geographical feature on the map (e.g. by clicking)
`showToolbar` | Boolean | <optional> | true | Whether or not to show the side bar with layer list, etc. True by default.
`toolbarOpen` | Boolean | <optional> | false | Whether or not the toolbar is open when the map is initialized. Set to false by default, so that the toolbar is hidden by default.
`showScaleBar` | Boolean | <optional> | true | Whether or not to show a scale bar.
`showFeatureInfo` | Boolean | <optional> | true | Whether or not to allow users to click on map features to show more information about them.
`currentPosition` | Object | <optional> | { longitude: null, latitude: null, height: null} | An object updated by the map widget to show the longitude, latitude, and height (elevation) at the position of the mouse on the map. Note: The CesiumWidgetView does not yet update the height property.
`currentScale` | Object | <optional> | { meters: null, pixels: null } | An object updated by the map widget that gives two equivalent measurements based on the map's current position and zoom level: The number of pixels on the screen that equal the number of meters on the map/globe.
`currentViewExtent` | Object | <optional> | { north: null, east: null, south: null, west: null } | An object updated by the map widget that gives the extent of the current visible area as a bounding box in longitude/latitude coordinates.

Source:
  - src/js/models/maps/Map.js, line 125

### Methods

####
initialize(config)

Run when a new Map is created.

##### Parameters:

Name | Type | Description
--- | --- | ---
`config` | MapConfig | An object specifying configuration options for the map. If any config option is not specified, the default will be used instead (see MapModel#defaults).

Source:
  - src/js/models/maps/Map.js, line 207

####
selectFeatures(features, replaceopt)

Set or unset the selected Features on the map model. A selected feature is a polygon, line, point, or other element of vector data that is in focus on the map (e.g. because a user clicked it to show more details.)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`features` | Feature | Array.<Object> |  |  | An array of Feature models or objects with attributes to set on new Feature models. If no features argument is passed to this function, then any currently selected feature will be removed (as long as replace is set to true)
`replace` | Boolean | <optional> | true | If true, any currently selected features will be replaced with the newly selected features. If false, then the newly selected features will be added to any that are currently selected.

Source:
  - src/js/models/maps/Map.js, line 242