Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

@openhistoricalmap/events

Read and edit the historical events of an OpenHistoricalMap node, way or relation.

An event is a relation tagged type=event, with event=*, name, start_date and optional end_date, description, wikidata and source. The affected object is a member with role=location.

Core

import { EventsEditor, upload } from "@openhistoricalmap/events";

const editor = await EventsEditor.load({ type: "way", id: 201162207 }, { apiUrl: "/api/0.6" });
editor.events;                                     // sorted by start_date
editor.add({ event: "fire", name: "Great fire", start_date: "1871-10-08" });
editor.update(123, { end_date: "1871-10-10" });    // empty value removes a tag
editor.remove(123);                                // deletes the relation, or only unlinks the object if it has other members
editor.toOsmChange(changesetId);                   // osmChange XML

await upload(editor, { authorization: "Bearer <token>", comment: "Add event" });

upload creates a changeset, uploads one osmChange and always closes the changeset.

UI

mountPanel(container, { editor, canEdit, uploadOptions, onDateClick }) renders the list and a Bootstrap modal to add, edit and remove events. mountOhmWebsite({ map, type, id }) mounts it in the element sidebar of the OHM website.

Development

npm install
npm test
npm run build   # dist/ohm-events.js, a single ES module

Demo

python3 -m http.server 8765
# open http://localhost:8765/demo/

The demo reads real data from openhistoricalmap.org and never uploads. Saving shows the osmChange that would be sent. If the API is not reachable it uses demo/fixtures.js.

Install from GitHub

dist/ is committed, so it works without npm:

yarn add github:Rub21/ohm-events#v0.1.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages