Skip to content

shadcn.io is an independent project built on shadcn/ui

Oil Pipeline Map Block for React

A 798 km crude line across Texas on a live map: slide along the pipe to read the pressure, see where it runs under the floor, and fly to any stretch.

On this page5 sections

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Read the pressure anywhere along a pipeline, with this oil pipeline map for React with Base UI. Trunkmarsh, a pipeline operator, runs a 798 km crude line from Midland across the Texas Hill Country to a tank farm at Baytown on the Gulf, drawn on a live Map that follows your theme, with five pump stations at real towns along a course that keeps to their road corridors. A Slider in the dock under the map, "Position along the line", moves a cursor along the pipe that reads the pressure in bar, and the stretch under it becomes the one coloured line. Each station sends the crude out at a typed outlet pressure and friction takes a typed number of bar for every kilometre, so a profile chart beside the reading falls along each stretch and steps up at each station; where the pressure drops under the 30 bar floor the pipe turns dashed on the map and says so. Six station cells, and the squares on the map, jump the cursor to a station and fly the camera to its stretch. Built from Map, Slider, Button and Guides. For pipeline operators, control rooms and engineering reviews.

FAQ

How is the pressure at a kilometre worked out?

pressureAt finds the last pump station at or before the kilometre and returns its outlet pressure minus its friction rate times the distance from it. The profile chart draws the same numbers: a fall along each stretch and a step up at the next station. The cursor's pill, the reading in the dock and each station's intake use that one function.

How is the stretch under the floor found?

For each stretch, lowFromOf works out the kilometre where its falling pressure crosses the 30 bar FLOOR; if that comes before the next station, the rest of the stretch is under the floor. Those stretches are drawn dashed over the pipe and labelled on the map, the floor is a dashed line on the chart, and the reading says how many bar over or under the floor the cursor is.

Where does the line come from, and what stays local?

The course was asked once of the public OSRM router, through the six towns, and baked into the file as 73 points; nothing is fetched at runtime but the map tiles, CARTO's free basemaps over OpenStreetMap data with their credit kept. The towns are real; Trunkmarsh, the pressures and the flows are invented, nothing is read from a sensor and nothing is sent.

How does the map fly to a stretch?

The block keeps one aim: the whole line or the stretch of the chosen station. MapCamera frames it at the start and flies to each new one, at once when reduced motion is on, with room kept for the cursor's pill and the zoom buttons. The route button brings the whole line back.

Can I use it without a mouse?

Yes. The slider takes the arrow keys, Page Up and Page Down, and its value text says the kilometre and the pressure; the station cells are buttons with a pressed state, the station squares on the map are a pointer shortcut to the same choice, and the zoom buttons and the map itself take the keyboard. A polite message gives the reading and the margin over the floor once the slider settles.

How does it look on a phone?

The map comes first with the station names as tooltips, then the reading, the profile chart and the slider full width, and the station cells two to a row. Scrolling the page over the map scrolls the page; two fingers move the map.