Geospatial Scatter Chart¶
Geospatial scatter charts distribute data from a data source across geographical locations, and, optionally, color the data points based on the database field of your choice and scale the size of data points. The sample images in the next section demonstrate how to construct a geospatial scatter chart to locate the nighborhoods in NYC with the most rooms available at a specified price.
Geospatial scatter charts use the Coordinates, Color and Size encoding channels. See Geospatial Customization Options for additional options for customizing your geospatial charts.
The Coordinates encoding channel defines the map
area of geospatial charts. The image below distributes all of the instances
location geopoint in the Sample AirBnB Listings Dataset.
However, all of the circles are green and the same size since we have
not yet specified fields for the Size and Color
Atlas provides several sample data sets for download.
See the Geopoint reference page for more information about what types of data you can use in this channel.
(Optional) The Color encoding channel changes the color of the data points to
categorize the displayed geopoints by the value of the selected collection field. MongoDB Charts lists
the colors used in a key to the right of the chart. In the image below, the
distributes the property types in NYC by color. The key to the right of the chart indicates
green for guest suites and dark blue for apartments, for example.
However, all of the circles are still the same size since we have
not yet specified a field for the Size encoding channel.
(Optional) The Size aggregation encoding channel changes the size of the
data point markers, with larger sizes indicating larger aggregated values. The image below
uses the mean of the
weekly_price collection field to aggregate all instances of the geopoint that you
chose for the Coordinates encoding channel. The key to right of the chart
indicates the aggregation value for the different circle sizes.
If no fields are encoded in the Size encoding channel, Charts displays all points with the same size.
The maximum query response size for Scatter charts is 1000 documents.
Build a Geospatial Scatter Chart¶
To create a geospatial scatter chart:
- On the Chart Builder, select Geospatial from the Chart Type list.
- Select Scatter from the three available geospatial chart types.
Choose the data source for your chart from the Data Source list.NoteSee Add a Data Source if you have not yet defined a data source for your charts.
Drag a geopoint field from Fields to the Coordinates encoding channel.
MongoDB Charts distributes the data from your MongoDB collection based on the values of the selected geopoint field.
(Optional) Drag another collection field from the Fields to the Color encoding channel.
MongoDB Charts colors the data points according to your selection.
(Optional) Drag another collection field to the Size encoding channel.
MongoDB Charts aggregates document fields with matching values in the data source.
- Click the pencil icon above the chart to give it name.
- Click Save and Close.