Map layers and basemaps

Layers and base maps that make up the project summary map and project components map

Sources, Layers, and Source Types

The main layer source typearrow-up-right in Moped is GeoJSON. The pattern for adding a source and layer to a react-map-gl map is to use the Sourcearrow-up-right and Layerarrow-up-right components. These two components are abstraction of Mapbox GL sourcesarrow-up-right and layersarrow-up-right. The Source component is responsible for the data and the Layer component is used to style the data of the source. An example of JSX for a vector tile layer is below.

<Source
  key={config.layerIdName}
  type="geojson"
  data={theGeojsonData}
>
  <Layer
    key={config.layerIdName}
    {...theOtherlayerProps}
  />
</Source>

GeoJSON layers

Layers that are created from user input (like selecting from the CTN segments or intersection layer or drawing lines or points) require a source with typearrow-up-right geojson and, in Moped, the geojson is formatted as a GeoJSON feature collection.

The CTN segments and intersection points are also populated with GeoJSON data queried from AGOL feature servers called CTN segments FeatureServerarrow-up-right and COA Intersection points FeatureServerarrow-up-right.

Base Maps

Default basemap

In Moped, the default basemap style is Mapbox Lightarrow-up-right and the streets layer for the mapStyle proparrow-up-right in react-map-gl is mapbox://styles/mapbox/light-v10.

Aerial Imagery basemap

To add aerial imagery, a Nearmap layer is added as a raster tile set. Nearmap access and the API key is managed by CTM and can be inquired about through the COA ServiceNow Portalarrow-up-right. The API key is stored in the DTS 1Password Developers vault and is titled Moped Nearmap API Key.

The aerial basemap is added by providing a raster tile configuration that uses the Nearmap API endpoint along with the API key to provide aerial tiles. A sample configuration is shown below. A Mapbox example of using a custom tile set is herearrow-up-right. This configuration is passed to the mapStyle proparrow-up-right of a react-map-gl map much like the default streets basemap above. This time, an object is passed instead of the string source of a Mapbox style.

Last updated

Was this helpful?