Map layers and basemaps
Layers and basemaps that make up the project summary and project edit maps
Last updated
Was this helpful?
Layers and basemaps that make up the project summary and project edit maps
Last updated
Was this helpful?
The two layer in Moped are vector tile layers and GeoJSON layers. The pattern for adding a source and layer to a react-map-gl
map is to use the and components. These two components are abstraction of Mapbox GL and . 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.
Vector tile layers are used to display streets and points that a user can interact with to add and remove GeoJSON features associated with a project. These vector tile layers are maintained in ArcGIS Online (AGOL).
GeoJSON layers are generated from user input like those stored from the drawing UI exposed by the useMapDrawTools
custom hook.
The two vector tile layers used in Moped are for street lines and intersection points. They are located at the following ArcGIS endpoints:
ArcGIS vector tile layer metadata and tiles links user the following patterns (using the CTN layer as an example).
If this data is not passed, it can lead to issue with rendering and capturing geometries with Mapbox GL. Here is one example where lines were split along the vector tiles beyond a certain level of zoom.
Streets
Points
To add vector tile layers sourced from ArcGIS or other endpoints, the layer can be added by using the and adding source
and source-layer
keys and values to the spec as shown below. This object defines props that are passed to the component from react-map-gl.
Note that the geometry (circle, line, etc.) in a vector layer determines the style properties from the Mapbox spec that are required to customize the layer.
Vector tile .pbf endpoint (used to render tiles on map)
Vector tile styles metadata (helpful for finding the source layer name and type of geometry in layer)
Vector tile server metadata
When adding a vector tile layer, it is important to consider the maxLOD
of the vector tile layer that is shown in the server metadata (see example link above) and pass that value as the along with the endpoint. A good example of this in a react-map-gl
component can be found in .
Layers that are created from user input (like drawn points) require a source with geojson
and, in Moped, the geojson is formatted as a GeoJSON feature collection.
In Moped, the default basemap style is and the streets layer for the in react-map-gl
is mapbox://styles/mapbox/light-v8
.
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 . 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 . This configuration is passed to the 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.