field-of-view
field-of-view is a JavaScript library to create photo fields of view GeoJSON geometries. field-of-view can be used in tools for photo geotagging, for example:
- Leaflet.GeotagPhoto - Leaflet plugin for photo geotagging
- Surveyor - web application for crowdsourced image geotagging
- Street View, Then & Now: New York City's Fifth Avenue
field-of-view is developed for The New York Public Library's NYC Space/Time Directory.
Input
Point
: camera locationLineString
with two points: field of viewGeometryCollection
with twoPoint
geometries: camera and target locationsGeometryCollection
with threePoint
geometries: camera and target locations, and a point to determine the angle of the field-of-view
See the API section for more details.
Output
GeometryCollection
with two geometries:Point
: location of cameraLineString
: field of view
Example:
Installation
Using Node.js:
npm install field-of-view
Browser:
Usage
Node.js example:
const fieldOfView = const feature = type: 'Feature' properties: angle: 50 geometry: type: 'LineString' coordinates: 490028 5237249 490065 5237262 const fov = fieldOfView console
API
fieldOfView.fromFeature (feature, options)
Converts feature
to Field of View geometry; feature
must be one of the following GeoJSON objects:
Point
- Point is camera location
properties.bearing
should be specifiedproperties.distance
should be specified
LineString
with two points; this is the field of view of the photoGeometryCollection
with twoPoint
geometries- Point location of the camera
- Point location of the camera's target
GeometryCollection
with threePoint
geometries- Point location of the camera
- Point location of the camera's target
- Point determining the angle of the field-of-view
In all cases except the last, features must specify the camera's angle of view by setting properties.angle
, or by passing the angle
as an option to the field-of-view
module:
const options = angle: 45
fieldOfView.fromFeature
returns a single feature with a GeometryCollection
containing two geometries, the location of the camera and the field of view. The feature's properties
contains three values:
angle
: angle of view of camera (0 - 180)bearing
: bearing of camera (0 - 360)distance
: distance between camera and target, in meters
See the Output section for an example.