geotag

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: BSD-3-Clause Imports: 4 Imported by: 3

README

go-geojson-geotag

Go package for working with GeoJSON features produced by the Leaflet.GeotagPhoto JavaScript package.

Documentation

Go Reference

Example

package main

import (
	"encoding/json"
	"github.com/sfomuseum/go-geojson-geotag/v2"
	"io"
	"os"
)

func main() {

	body, _ := io.ReadAll(os.Stdin)

	f, _ := geotag.NewGeotagFeature(body)
	fov, _ := f.FieldOfView()

	enc := json.NewEncoder(os.Stdout)
	enc.Encode(fov)
}

Error handling omitted for the sake of brevity.

See also

Documentation

Overview

package geotag provides methods for working with GeoJSON features produced by the `Leaflet.GeotagPhoto` JavaScript package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CameraProperties

type CameraProperties struct {
	// The ID of the Who's On First (WOF) feature that immediately parents the point where the "camera" is located.
	ParentId int64 `json:"wof:parent_id,omitempty"`
	// The ID of the Who's On First (WOF) hierarchy of ancestors that parents the point where the "camera" is located.
	Hierarchy []map[string]int64 `json:"wof:hierarchy,omitempty"`
}

CameraProperties is a struct containing Who's On First pointers for the point where the "camera" is located.

type GeotagCoordinate

type GeotagCoordinate [2]float64

GeotagCoordinate defines a longitude, latitude coorindate.

type GeotagFeature

type GeotagFeature struct {
	// The unique ID associated with this feature.
	Id string `json:"id,omitempty"`
	// The GeoJSON type for this feature. It is expected to be `Feature`
	Type string `json:"type"`
	// The GeoJSON coordinates associated with this struct.
	Geometry GeotagGeometryCollection `json:"geometry"`
	// The metadata properties associated with this feature.
	Properties GeotagProperties `json:"properties"`
}

GeotagFeature defines a GeoJSON Feature produced by the `Leaflet.GeotagPhoto` package

func NewGeotagFeature

func NewGeotagFeature(body []byte) (*GeotagFeature, error)

NewGeotagFeatureWithReader returns a new `GeotagFeature` reading data from 'body'.

func NewGeotagFeatureWithReader

func NewGeotagFeatureWithReader(r io.Reader) (*GeotagFeature, error)

NewGeotagFeatureWithReader returns a new `GeotagFeature` reading data from 'r'.

func (*GeotagFeature) FieldOfView

func (f *GeotagFeature) FieldOfView() (*GeotagPolygon, error)

FieldOfView returns the "field of view" area for 'f' as a polygon. The "field of view" is defined as the point from which the camera view begins to its two outer extremities.

func (*GeotagFeature) HorizonLine

func (f *GeotagFeature) HorizonLine() (*GeotagLineString, error)

HorizonLine returns the "horizon line" for 'f' as a line string. The "horizon" line is defined as the line between the two outer points in the field of view.

func (*GeotagFeature) PointOfView

func (f *GeotagFeature) PointOfView() (*GeotagPoint, error)

PointOfView returns the focal point of 'f' as a point. The focal point is defined as the coordinate where the "camera" is located.

func (*GeotagFeature) Target

func (f *GeotagFeature) Target() (*GeotagPoint, error)

Target returns the coordinate at the center of the "horizon line" for f as a point.

type GeotagGeometryCollection

type GeotagGeometryCollection struct {
	// The GeoJSON type for this geometry. It is expected to be `GeometryCollection`
	Type string `json:"type"`
	// The GeoJSON coordinates associated with this struct.
	Geometries [2]interface{} `json:"geometries"`
}

GeotagGeometryCollection defines a GeoJSON `GeometryCollection` geometry element.

type GeotagLineString

type GeotagLineString struct {
	// The GeoJSON type for this geometry. It is expected to be `LineString`
	Type string `json:"type"`
	// The GeoJSON coordinates associated with this struct.
	Coordinates [2]GeotagCoordinate `json:"coordinates"`
}

GeotagPoint defines a GeoJSON `LineString` geometry element.

type GeotagPoint

type GeotagPoint struct {
	// The GeoJSON type for this geometry. It is expected to be `Point`
	Type string `json:"type"`
	// The GeoJSON coordinates associated with this struct.
	Coordinates GeotagCoordinate `json:"coordinates"`
}

GeotagPoint defines a GeoJSON `Point` geometry element.

type GeotagPolygon

type GeotagPolygon struct {
	// The GeoJSON type for this geometry. It is expected to be `Polygon`
	Type string `json:"type"`
	// The GeoJSON coordinates associated with this struct.
	Coordinates [][]GeotagCoordinate `json:"coordinates"`
}

GeotagPolygon defines a GeoJSON `Polygon` geometry element.

type GeotagProperties

type GeotagProperties struct {
	// The angle for the field of view
	Angle float64 `json:"geotag:angle"`
	// The bearing for camera
	Bearing float64 `json:"geotag:bearing"`
	// The distance from the camera to the center point of the field of view's edges.
	Distance float64 `json:"geotag:distance"`
	// Camera is a `CameraProperties` instance containing Who's On First pointers for the point where the "camera" is located.
	Camera *CameraProperties `json:"geotag:camera"`
	// Target is a `TargetProperties` instance containing Who's On First pointers for the point where the "camera" is pointed.
	Target *TargetProperties `json:"geotag:target"`
}

GeotagProperties defines properties exported by the `Leaflet.GeotagPhoto` package and, optionally, by the sfomuseum/go-www-geotag package.

type TargetProperties

type TargetProperties struct {
	// The ID of the Who's On First (WOF) feature that immediately parents the point targeted by the "camera".
	ParentId int64 `json:"wof:parent_id,omitempty"`
	// The ID of the Who's On First (WOF) hierarchy of ancestors that parents the point targeted by the "camera".
	Hierarchy []map[string]int64 `json:"wof:hierarchy,omitempty"`
}

TargetProperties is a struct containing Who's On First pointers for the point where the "camera" is pointed.

Directories

Path Synopsis
cmd
package cmd provides command line tools for working with GeoJSON features produced by the `Leaflet.GeotagPhoto` JavaScript package.
package cmd provides command line tools for working with GeoJSON features produced by the `Leaflet.GeotagPhoto` JavaScript package.
fov command
fov is a command-line tool that read a "geotag" GeoJSON Feature on SDTIN and outputs its "field of view area as a GeoJSON geometry element.
fov is a command-line tool that read a "geotag" GeoJSON Feature on SDTIN and outputs its "field of view area as a GeoJSON geometry element.
pov command
pov is a command-line tool that read a "geotag" GeoJSON Feature on SDTIN and outputs its camera's "point of view area as a GeoJSON geometry element.
pov is a command-line tool that read a "geotag" GeoJSON Feature on SDTIN and outputs its camera's "point of view area as a GeoJSON geometry element.

Jump to

Keyboard shortcuts

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