@micropasts/linked-art-geotrail
v0.1.3
Published
An interactive React component for visualizing Linked Art cultural heritage records as animated geospatial event arcs.
Maintainers
Readme
@micropasts/linked-art-geotrail
An interactive geospatial event-arc viewer for Linked Art (application/ld+json) cultural heritage records. It uses React 18, Vite, Tailwind CSS, Lucide, and MapLibre GL, and complements linked-art-viewer and provenance-timeline.
Features
- Event-to-place arcs: Extracts spatial events from production, discovery, provenance, exhibitions, and current-location fields, then plots and animates quadratic Bezier trajectories.
- Manual playback: Starts at the origin and advances through Play, timeline scrubbing, or event selection.
- WKT and text-place resolution: Supports
POINT,POLYGON, andMULTIPOLYGON; text places can use the built-in gazetteer or a cached Nominatim fallback. - Attached imagery: Finds representations and digital images, optimizes IIIF Image API URLs, compresses CORS-accessible images, and provides a full-resolution lightbox.
- URL and JSON-LD loading: Accepts raw Linked Art JSON-LD or an
http(s)://record URL. - Embeddable props: Passes a record directly and can hide the loader with
allowInput={false}. - Dark and light themes: Switches the interface and MapLibre basemap between dark-matter and positron.
Project Structure
linked-art-geotrail/
├── index.html
├── examples/
│ └── index.html
├── package.json
├── postcss.config.js
├── tailwind.config.js
├── vite.config.js
├── README.md
├── LICENSE.md
├── dist/
├── dist-lib/
├── dist-umd/
├── docs/
└── src/
├── main.jsx
├── index.jsx
├── umd.jsx
├── index.css
├── App.jsx
├── docs/
│ ├── main.jsx
│ └── DocsApp.jsx
├── data/
│ ├── exampleRecords.js
│ ├── gettyRecord.js
│ ├── piebaldRecord.js
│ └── sampleRecord.js
├── lib/
│ ├── arcGeometry.js
│ ├── imageOptimizer.js
│ ├── linkedArtExtractor.js
│ ├── linkedArtFetcher.js
│ ├── placeResolver.js
│ └── wktParser.js
└── components/
├── EventSidebar.jsx
└── GeoArcMap.jsxGetting Started
npm install
npm run devOpen the address printed by Vite (normally http://localhost:5173).
Install in a Third-Party npm Project
Install the package and its React peer dependencies:
npm install @micropasts/linked-art-geotrail react react-domImport the component and stylesheet, then give it a sized container:
import GeoTrail from '@micropasts/linked-art-geotrail';
import '@micropasts/linked-art-geotrail/style.css';
export function MuseumObjectTrail({ record }) {
return (
<div style={{ height: '700px', width: '100%' }}>
<GeoTrail
record={record}
allowInput={false}
theme="light"
/>
</div>
);
}When developing with React 18, the package uses the same React instance supplied by the host project. The host must also provide React DOM. The component bundles Lucide and includes MapLibre styles, but it does not bundle React.
The package also exports App as a named export:
import { App } from '@micropasts/linked-art-geotrail';For a package from this repository rather than a published registry release:
npm install github:MicroPasts/linked-art-geotrailPublishing and installing the scoped npm package requires npm registry access to @micropasts. A release build is produced with:
npm run build:lib
npm publish --access publicStatic app build
Build the full app and the examples/docs page:
npm run build
npm run previewThe output is written to dist/ and can be deployed to static hosting such as GitHub Pages.
Documentation and examples build
npm run build:docsThis writes the examples/docs page to docs/.
UMD browser build
Create a browser-ready UMD bundle:
npm run build:umdThe build writes linked-art-geotrail.umd.js and linked-art-geotrail.css to dist-umd/.
Serve or deploy that directory, then mount the viewer from a plain HTML page:
<link rel="stylesheet" href="/dist-umd/linked-art-geotrail.css">
<div id="geotrail" style="height: 700px"></div>
<script src="/dist-umd/linked-art-geotrail.umd.js"></script>
<script>
const root = LinkedArtGeoTrail.mount('#geotrail', {
record: window.myLinkedArtRecord,
allowInput: false,
theme: 'light'
});
</script>The mount target can also be an element:
const root = LinkedArtGeoTrail.mount(
document.getElementById('geotrail'),
{ allowInput: false, theme: 'dark' }
);Call root.unmount() when removing the mounted component.
Embedding & Component Props
You can render App with an initial Linked Art object, lock it to read-only display mode without the URL/JSON input drawer, and choose light or dark mode:
import App from './App';
import myLinkedArtRecord from './data/myObject.json';
export function MuseumObjectTrail() {
return (
<App allowInput={false} record={myLinkedArtRecord} theme="light" />
);
}Props
| Prop | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| record | Object | SAMPLE_LINKED_ART_RECORD | Initial Linked Art JSON-LD document to parse and plot. |
| allowInput | boolean | true | Shows or hides the Load URL / JSON button and input drawer. |
| theme | 'dark' \| 'light' | 'dark' | Sets the initial visual theme for the sidebar, popups, and map style. |
How Linked Art Records Are Extracted
- Production (
produced_by): Extracts creation events,timespandisplay labels/dates,carried_out_bymakers,took_place_atWKT geometries, or object/activityCreation Place Description(aat:300435448) text statements. - Discovery (
encountered/found_by): Captures findspot or archaeological encounter events and any associatedPOLYGONorPOINTgeometries. - Provenance (
changed_ownership_through): Reads ownership transfers and nestedpart_ofprovenance activities, timespans, and provenance location statements (aat:300444175). - Exhibitions (
used_for/member_of[].used_for): Collects exhibition activities and venues. - Current Location (
current_location): Plots repository locations; ifcurrent_locationis an internal space (such as Getty"Storage",aat:300004465) without WKT coordinates, it pairs the label withcurrent_ownerinstitution details for geocoding.
License
MIT
