Closed ghost closed 8 years ago
Another custom type worth supporting is localized legend presets.
The observation example should also have an index for sorting observations by creation date.
I have this working in osm-p2p/example/obs.js
$ rm -rf /tmp/osmdb/
$ node obs.js create '{"type":"node","lat":64.5,"lon":-120.9}'
78ac08875010bc25
$ node obs.js create '{"type":"observation","ref":"78ac08875010bc25","tags":{"comment":"whatever"}}'
5a0ac8da1d5d7b94
$ node obs.js query 64,65 -121,-120
{ type: 'node',
lat: 64.5,
lon: -120.9,
id: '78ac08875010bc25',
version: '79ef998702011be7fdf263c2e924cfa64fdccb4b2ef996164763b89650d12597',
observations: [ { type: 'observation', ref: '78ac08875010bc25', tags: [Object] } ] }
Moving this discussion to digidem/osm-p2p-observations and https://github.com/digidem/osm-p2p-db/issues/23
This feature would support adding custom new types on top of the existing entities. For example, an
observation
type might describe a fact at a particular time and place by linking to a node, but observations would be immutable whereas nodes and other entities can mutate.Aside from reading refs and members from ways and relations, the database doesn't care what type a document is, so observation types could be added right now. Observations would likely need their own index over the hyperlog, which is also possible to do externally before the log is passed to osm-p2p-db.
I think this use case warrants an example. If the example is messy or difficult, I'll make a separate module or plugin mechanism to make custom types easier to deal with.