aai agency logo
OG Components Docs

Asset Map

Interactive map for Oil and Gas assets. Render wells, facilities, and custom asset types with clustering, color schemes, drawing tools, and overlay uploads.

Preview

Loading well data...

<Map
  assets={djBasinWells}
  mapboxAccessToken={MAPBOX_TOKEN}
  colorBy="status"
  height="500px"
  enableOverlayUpload
  showDetailCard
  controls={["pan", "zoom", "fullscreen", "center", "draw-polygon", "layers"]}
  layers={["assets", "lines"]}
/>

Installation

bash
pnpm add @aai-agency/og-components mapbox-gl

Usage

tsx
import { Map } from "@aai-agency/og-components";
import "mapbox-gl/dist/mapbox-gl.css";

export function AssetMap({ assets }) {
  return (
    <Map
      assets={assets}
      mapboxAccessToken={import.meta.env.VITE_MAPBOX_TOKEN}
      colorBy="status"
      height="700px"
      enableOverlayUpload
      showDetailCard
      controls={[
        "pan", "zoom", "fullscreen", "center",
        "draw-polygon", "draw-rectangle", "draw-circle",
        "layers", "labels",
      ]}
      layers={["assets", "overlays"]}
    />
  );
}

Props

PropTypeDefaultDescription
assetsAsset[]-Array of asset objects to display on the map.
mapboxAccessTokenstring-Your Mapbox GL access token.
mapStylestring"mapbox://styles/mapbox/light-v11"Mapbox style URL.
colorByColorScheme"status"Color scheme for asset markers. One of: status, type, production, waterCut, wellType, operator, basin.
onColorByChange(scheme: ColorScheme) => void-Callback when color scheme changes via legend.
heightstring | number"500px"Map container height.
clusterbooleanfalseEnable marker clustering at low zoom levels.
enableOverlayUploadbooleanfalseEnable drag-and-drop overlay upload (KMZ, KML, GeoJSON, Shapefile).
showDetailCardbooleantrueShow asset detail card on click.
showControlsbooleantrueShow the map controls toolbar.
controlsMapControlId[]-Which controls to show: pan, zoom, fullscreen, center, draw-polygon, draw-rectangle, draw-circle, layers, labels.
layersMapLayerId[]-Toggleable layers: assets, clusters, overlays, labels.
onAssetClick(asset: Asset) => void-Callback when an asset is clicked.
onAssetHover(asset: Asset | null) => void-Callback when an asset is hovered.
onViewStateChange(viewState: MapViewState) => void-Callback on pan or zoom.