geotag

package
v0.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package geotag provides methods for updating SFO Museum Who's On First records with geotagging depictions.

Index

Constants

View Source
const GEOTAG_LABEL string = "geotag-fov" // field of view

GEOTAG_LABEL is the Who's On First alternate geometry label for the "field of view" alternate geometry record

View Source
const GEOTAG_NS string = "geotag"

GEOTAG_NS is the prefix (namespace) to assign to geotagging specific properties.

View Source
const GEOTAG_SRC string = "geotag"

GEOTAG_SRC is the (whosonfirst/whosonfirst-sources) source label identifying the source of the geotagging geometry.

Variables

This section is empty.

Functions

func UpdateDepiction

func UpdateDepiction(ctx context.Context, opts *UpdateDepictionOptions, update *Depiction) ([]byte, error)

UpdateDepiction will update the geometries and relevant properties for SFOM/WOF records 'depiction_id' and 'subject_id' using data defined in 'geotag_f' and 'parent_id'.

'geotag_f' is a GeoJSON Feature produced by the https://github.com/sfomuseum/Leaflet.GeotagPhoto package. There is also a https://github.com/sfomuseum/go-geojson-geotag Go package but we are not using it at this time.

Here's how things work:

First we retrieve the subject record associated with 'depiction_id' and update its geometry; This is assumed to be the value of the `wof:parent_id` property in the WOF/GeoJSON record for 'depiction_id'. The rules for updating subject geometries are:

  • If the geometry is a `Point` we assume that the subject (and its depictions) have not been geotagged and assign the focal point (centroid) of the 'geotag_f' feature as the first element of a new `MultiPoint` geometry.
  • If the geometry is a `MultiPoint` we assume that the subject and at least one of its depictions have been geotagged. The will assign the focalpoint (centroid) of the 'geotag_f' feature to the existing `MultiPoint` geometry assuming it is not already present.
  • Other geometry types will trigger an error, at this time.

If 'parent_id' is not `-1` the code retrieve the record associated with that ID and updates the `wof:parent_id` and `wof:hierarchy` properties (in the subject record) with the `wof:id` and `wof:hierarchy` properties, respectively, in the parent record.

After exporting and writing the subject record the depiction record associated with 'depiction_id' is retrieved.

  • Its geometry is assigned the focal point (centroid) of the 'geotag_f' feature.
  • Its `wof:hierarchy` property is updated with the corresponding value in the subject record.
  • Other relevant properties are updated notably the `src:geom_alt` property which references an alternate geometry for the depiction to be created or updated.

After exporting and writing the depiction record a new alternate geometry (`geotag-fov`) is created for the depiction. - Its geometry is assigned the field of view (line string) of the 'geotag_f' feature.

Finally the alternate geometry is exported and written (to `opts.DepictionWriter`).

Types

type Depiction

type Depiction struct {
	// The unique numeric identifier of the depiction being geotagged
	DepictionId int64 `json:"depiction_id"`
	// The GeoJSON Feature containing geotagging information
	Feature *geotag.GeotagFeature `json:"feature"`
}

type Depiction is a struct definining properties for updating geotagging information in an depiction and its parent subject.

type UpdateDepictionOptions

type UpdateDepictionOptions struct {
	// A valid whosonfirst/go-reader.Reader instance for reading depiction features.
	DepictionReader reader.Reader
	// A valid whosonfirst/go-writer.Writer instance for writing depiction features.
	DepictionWriter    writer.Writer
	DepictionWriterURI string
	// A valid whosonfirst/go-reader.Reader instance for reading subject features.
	SubjectReader reader.Reader
	// A valid whosonfirst/go-writer.Writer instance for writing subject features.
	SubjectWriter    writer.Writer
	SubjectWriterURI string
	// A valid whosonfirst/go-reader.Reader instance for reading "parent" features.
	ParentReader reader.Reader
	// The name of the person (or process) updating a depiction.
	Author string
}

UpdateDepictionOptions defines a struct for reading/writing options when updating geotagging information in depictions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL