Skip to content

Latest commit

 

History

History
846 lines (521 loc) · 22.9 KB

README.md

File metadata and controls

846 lines (521 loc) · 22.9 KB

Table of Contents

Graph

ngraph.graph helper functions for weighted graph computation

GetData

Get graph data from the points which are walkable given an origin lat/long, radius, and distance between points for creation of a grid.

Parameters

  • grid Array<Point> A grid of Turf.js points
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Array> A ngraph.graph object.

Create

Get graph object representing the points which are walkable given an origin lat/long, radius, and distance between points for creation of a grid.

Parameters

  • grid Array<Point> A grid of Turf.js points containing 'properties' objects which contain the data needed (greenScore, parkScore, etc.) to compute the weighted graph.
  • linkTolerance Number The minimum distance between points to be considered a 'link'.

Returns Graph A ngraph.graph object.

NearestNodeId

Find the node in the graph which is nearest to the lat/long provided.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • lat Number Latitude of start location.
  • long Number Longitude of start location.

Returns String The id of the nearest node.

Graph

Module for getting weather-specific data from a place.

GetData

Get graph data from the points which are walkable given an origin lat/long, radius, and distance between points for creation of a grid.

Parameters

  • grid Array<Point> A grid of Turf.js points
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Array> A ngraph.graph object.

Create

Get graph object representing the points which are walkable given an origin lat/long, radius, and distance between points for creation of a grid.

Parameters

  • grid Array<Point> A grid of Turf.js points containing 'properties' objects which contain the data needed (greenScore, parkScore, etc.) to compute the weighted graph.
  • linkTolerance Number The minimum distance between points to be considered a 'link'.

Returns Graph A ngraph.graph object.

NearestNodeId

Find the node in the graph which is nearest to the lat/long provided.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • lat Number Latitude of start location.
  • long Number Longitude of start location.

Returns String The id of the nearest node.

Geometry

Turf.js data and geometry helpers

BoundingBoxByRadius

Get a bounding box around a location with a given radius.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.

Returns BBox A Turf.js bounding box object.

PointGridRandom

Get a collection of random points which fall within a given bounding radius from an origin lat/long point.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.
  • numPoints Number How many points to return

Returns FeatureCollection<Point, any> A collection of Turf.JS points.

PointGrid

Get a collection of points in a gird which fall within a given bounding radius from an origin lat/long point.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.
  • pointDist Number How far apart the points should be in the point grid.

Returns Array<Point> A collection of Turf.JS points.

Geometry

Module for getting Turf.js geometry and helpers.

BoundingBoxByRadius

Get a bounding box around a location with a given radius.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.

Returns BBox A Turf.js bounding box object.

PointGridRandom

Get a collection of random points which fall within a given bounding radius from an origin lat/long point.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.
  • numPoints Number How many points to return

Returns FeatureCollection<Point, any> A collection of Turf.JS points.

PointGrid

Get a collection of points in a gird which fall within a given bounding radius from an origin lat/long point.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.
  • pointDist Number How far apart the points should be in the point grid.

Returns Array<Point> A collection of Turf.JS points.

Weather

Weather-related data for analysis.

SunPositionToday

Get a vector representation of the sun's position at the given location and today's date.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.

Returns Object An object containing azimuth and sun angle properties.

SunPosition

Get a vector representation of the sun's position at the given location and date.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • date Date Date to compute location at.

Returns Object An object containing azimuth and sun angle properties.

Weather

Module for getting weather-specific data from a place.

SunPositionToday

Get a vector representation of the sun's position at the given location and today's date.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.

Returns Object An object containing azimuth and sun angle properties.

SunPosition

Get a vector representation of the sun's position at the given location and date.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • date Date Date to compute location at.

Returns Object An object containing azimuth and sun angle properties.

Place

Yelp-related data for analysis.

ParkSearch

Get a collection of public parks from Google Maps within the given radius from the origin lat/long point.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Array> A collection of nearby parks.

Place

Module for getting nearby parks and other green public spaces.

ParkSearch

Get a collection of public parks from Google Maps within the given radius from the origin lat/long point.

Parameters

  • lat Number Latitude of location.
  • long Number Longitude of location.
  • radius Number The radius of the bounding geometry from the given lat/long origin.
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Array> A collection of nearby parks.

Color

Field of view analysis for nature/greenery.

BuildRequest

Build a url request for a google street view image.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • heading String Direction of google street view image (between 0 to 360).
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns String A url for google maps.

Palette

Get the color palette of the image from google street view at the given lat, long, and orientation.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • heading number Direction of google street view image (between 0 to 360).
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Object A collection of Objects containing color palette data.

PaletteNames

Get the color palette of a location as names of primary colors from google street view at the given lat, long, and orientation. Views will be taken at 0, 90 and 180 degrees around the central point.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Object A collection of Objects containing color palette data.

PaletteAnalysis

Get a percentage of "greenery" visible (dominant in the image color palette) in a 360 panorama taken at the given latitude/longitude.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Number> A decimal percentage of the prevalence of green in the field of view.

ClosestShadeName

Get the closest color hue name to the input color in hex format.

Parameters

  • hex String Hex code of color to parse.

Returns string A color name.

ClosestColorName

Get the closest color name to the input color in hex format.

Parameters

  • hex String Hex code of color to parse.

Returns string A color name.

Color

Module for getting color/color palette-specific data from points.

BuildRequest

Build a url request for a google street view image.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • heading String Direction of google street view image (between 0 to 360).
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns String A url for google maps.

Palette

Get the color palette of the image from google street view at the given lat, long, and orientation.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • heading number Direction of google street view image (between 0 to 360).
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Object A collection of Objects containing color palette data.

PaletteNames

Get the color palette of a location as names of primary colors from google street view at the given lat, long, and orientation. Views will be taken at 0, 90 and 180 degrees around the central point.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Object A collection of Objects containing color palette data.

PaletteAnalysis

Get a percentage of "greenery" visible (dominant in the image color palette) in a 360 panorama taken at the given latitude/longitude.

Parameters

  • lat String Latitude of location.
  • long String Longitude of location.
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Number> A decimal percentage of the prevalence of green in the field of view.

ClosestShadeName

Get the closest color hue name to the input color in hex format.

Parameters

  • hex String Hex code of color to parse.

Returns string A color name.

ClosestColorName

Get the closest color name to the input color in hex format.

Parameters

  • hex String Hex code of color to parse.

Returns string A color name.

Route

Route-related data for analysis.

Path

Find a path between two nodes on the graph, weighted by the 'Green Score' weight of the nodes along the potential path.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • idA String Node ID of start point.
  • idB String Node ID of end point.

Returns Object A ngraph.path object.

PathsAll

Compute all possible paths within the graph.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.

Returns Promise<Array> An array of all possible paths;

PathsFrom

Compute all possible paths within the graph which start from the given start point.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • lat Number Latitude of start location.
  • long Number Longitude of start location.

Returns Promise<Array> An array of all possible paths;

PathsLoop

Compute all possible looping paths within the graph which start and end at the given lat/long.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • lat Number Latitude of start location.
  • long Number Longitude of start location.

Returns Promise<Array> An array of all possible paths;

ParsePaths

Get graph data from the points which are walkable given an origin lat/long, radius, and distance between points for creation of a grid. Sort with the top nature walks first.

Parameters

  • json Object The raw path output of PathsAll().
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Array> A list of paths, sorted from most exposed to nature to least.

Route

Module for computing the actual routes.

Path

Find a path between two nodes on the graph, weighted by the 'Green Score' weight of the nodes along the potential path.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • idA String Node ID of start point.
  • idB String Node ID of end point.

Returns Object A ngraph.path object.

PathsAll

Compute all possible paths within the graph.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.

Returns Promise<Array> An array of all possible paths;

PathsFrom

Compute all possible paths within the graph which start from the given start point.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • lat Number Latitude of start location.
  • long Number Longitude of start location.

Returns Promise<Array> An array of all possible paths;

PathsLoop

Compute all possible looping paths within the graph which start and end at the given lat/long.

Parameters

  • graph Graph A ngraph.graph object with the nature-score data properties applied.
  • lat Number Latitude of start location.
  • long Number Longitude of start location.

Returns Promise<Array> An array of all possible paths;

ParsePaths

Get graph data from the points which are walkable given an origin lat/long, radius, and distance between points for creation of a grid. Sort with the top nature walks first.

Parameters

  • json Object The raw path output of PathsAll().
  • apiKey String (Optional) GoogleMaps API Key for the request. If none is provided, a process environment variable 'GMAPS_KEY' will be queried for the value. (optional, default process.env.GMAPS_KEY)

Returns Promise<Array> A list of paths, sorted from most exposed to nature to least.