geotag

package module
v1.0.0 Latest Latest
Warning

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

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

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"
	"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 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 added in v0.0.2

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:"angle"`
	// The bearing for camera
	Bearing float64 `json:"bearing"`
	// The distance from the camera to the center point of the field of view's edges.
	Distance float64 `json:"distance"`
	// The ID of the Who's On First (WOF) feature that immediately parents this feature.
	ParentId int64 `json:"wof:parent_id,omitempty"`
	// The ID of the Who's On First (WOF) hierarchy of ancestors that parents this feature.
	Hierarchy []map[string]int64 `json:"wof:hierarchy,omitempty"`
}

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

Directories

Path Synopsis
cmd
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.

Jump to

Keyboard shortcuts

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