AgentMaps/devdocs/global.html
noncomputable 533d029c5e Updates
2018-08-31 18:09:33 -04:00

4545 lines
55 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2></h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="agentmap"><span class="type-signature"></span>agentmap<span class="type-signature"></span></h4>
<div class="description">
Generates an agentmap for the given map.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agentmap.js.html">agentmap.js</a>, <a href="agentmap.js.html#line252">line 252</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addStreetLayerIntersections"><span class="type-signature">(private) </span>addStreetLayerIntersections<span class="signature">(street)</span><span class="type-signature"></span></h4>
<div class="description">
Gets the intersections of all the streets on the map and adds them as properties to the street layers.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>street</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Leaflet polyline representing a street.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line98">line 98</a>
</li></ul></dd>
</dl>
<h4 class="name" id="agent"><span class="type-signature"></span>agent<span class="signature">(lat_lng, options, agentmap)</span><span class="type-signature"></span></h4>
<div class="description">
Returns an agent object.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>lat_lng</code></td>
<td class="type">
<span class="param-type"><a href="global.html#LatLng">LatLng</a></span>
</td>
<td class="description last">A pair of coordinates to locate the agent at.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">An array of options for the agent, namely its layer.</td>
</tr>
<tr>
<td class="name"><code>agentmap</code></td>
<td class="type">
<span class="param-type"><a href="Agentmap.html">Agentmap</a></span>
</td>
<td class="description last">The agentmap instance in which the agent exists.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agents.js.html">agents.js</a>, <a href="agents.js.html#line665">line 665</a>
</li></ul></dd>
</dl>
<h4 class="name" id="checkEndExcess"><span class="type-signature">(private) </span>checkEndExcess<span class="signature">(path)</span><span class="type-signature"></span></h4>
<div class="description">
If the last two points before the goal point share the same street as the goal point, and the
first point is closer to the third (goal) point than it is to the second point, remove the
second point, as it's a superfluous detour.<br/><br/>
Typically happens when the goal point's nearest intersection is beyond it on the street,
and so the path would have an agent travel from the first point, then to the intersection (second point),
then backwards to the (third) goal point.<br/><br/>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">Array.&lt;<a href="global.html#LatLng">LatLng</a>></span>
</td>
<td class="description last">An array of LatLngs representing a path for an agent to travel along.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="routing.js.html">routing.js</a>, <a href="routing.js.html#line215">line 215</a>
</li></ul></dd>
</dl>
<h4 class="name" id="checkStartExcess"><span class="type-signature">(private) </span>checkStartExcess<span class="signature">(path)</span><span class="type-signature"></span></h4>
<div class="description">
If the first two points after the start point share the same street as the start point, and the
third point is closer to the first (start) point than it is to the second point, remove the
second point, as it's a superfluous detour.<br/><br/>
Typically happens when the start point's nearest intersection is beyond it on the street,
and so the path would have an agent travel from the start, then to the intersection,
then backwards to the third point.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">Array.&lt;<a href="global.html#LatLng">LatLng</a>></span>
</td>
<td class="description last">An array of LatLngs representing a path for an agent to travel along.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="routing.js.html">routing.js</a>, <a href="routing.js.html#line180">line 180</a>
</li></ul></dd>
</dl>
<h4 class="name" id="decodeCoordString"><span class="type-signature">(private) </span>decodeCoordString<span class="signature">(coord_string, place)</span><span class="type-signature"> &rarr; {<a href="global.html#LatLng">LatLng</a>}</span></h4>
<div class="description">
Turn a string containing coordinates (a graph node's ID) into a LatLng object.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>coord_string</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">A string containing coordinates in the format of "Latitude,Longitude".</td>
</tr>
<tr>
<td class="name"><code>place</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An object specifying the place of the coordinate string.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="routing.js.html">routing.js</a>, <a href="routing.js.html#line257">line 257</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- The coordinates encoded by the coord_string.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#LatLng">LatLng</a></span>
</dd>
</dl>
<h4 class="name" id="encodeLatLng"><span class="type-signature">(private) </span>encodeLatLng<span class="signature">(lat_lng)</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
Turn a LatLng object into a string representing its coordinates (to act as a graph node's ID).
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>lat_lng</code></td>
<td class="type">
<span class="param-type"><a href="global.html#LatLng">LatLng</a></span>
</td>
<td class="description last">The coordinates to encode into a string.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="routing.js.html">routing.js</a>, <a href="routing.js.html#line245">line 245</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- A string containing coordinates in the format of "Latitude,Longitude".
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="generateUnitFeatures"><span class="type-signature">(private) </span>generateUnitFeatures<span class="signature">(unit_anchors, proposed_unit_features, street_feature_id, unit_options)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Feature">Feature</a>>}</span></h4>
<div class="description">
Given an array of anchor pairs, for each anchor pair find four
nearby points on either side of the street appropriate to build a unit(s) on.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>unit_anchors</code></td>
<td class="type">
<span class="param-type">Array.&lt;Array.&lt;<a href="global.html#Feature">Feature</a>>></span>
</td>
<td class="description last">Array of pairs of points around which to anchor units along a street.</td>
</tr>
<tr>
<td class="name"><code>proposed_unit_features</code></td>
<td class="type">
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</td>
<td class="description last">Array of features representing building units already proposed for construction.</td>
</tr>
<tr>
<td class="name"><code>street_feature_id</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The Leaflet layer ID of the street feature along which the unit is being constructed..</td>
</tr>
<tr>
<td class="name"><code>unit_options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An object containing the AgentMaps styling options for units.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line203">line 203</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
unit_features - Array of features representing units.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</dd>
</dl>
<h4 class="name" id="getIntersections"><span class="type-signature"></span>getIntersections<span class="signature">(arr_a, arr_b, ids)</span><span class="type-signature"> &rarr; {Array.&lt;Array.&lt;(number|Object.&lt;number, number>)>>}</span></h4>
<div class="description">
Given two coordinate arrays, get their intersection.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>arr_a</code></td>
<td class="type">
<span class="param-type">array.&lt;array.&lt;number>></span>
</td>
<td class="description last">Array of coordinate pairs.</td>
</tr>
<tr>
<td class="name"><code>arr_b</code></td>
<td class="type">
<span class="param-type">array.&lt;array.&lt;number>></span>
</td>
<td class="description last">Array of coordinate pairs.</td>
</tr>
<tr>
<td class="name"><code>ids</code></td>
<td class="type">
<span class="param-type">array.&lt;number></span>
</td>
<td class="description last">2-element array whose elements are IDs for arr_a and arr_b respectively.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line84">line 84</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Array whose elements are the intersections' cooridinates if
ids is empty, or otherwise whose elements are arrays each of whose first element is an
intersection's coordinates and whose second element is an object mapping each array's ID (supplied by ids)
to the index of the intersecting coordinate-pair in that array.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;Array.&lt;(number|Object.&lt;number, number>)>></span>
</dd>
</dl>
<h4 class="name" id="getPathFinder"><span class="type-signature">(private) </span>getPathFinder<span class="signature">(graph)</span><span class="type-signature"> &rarr; {object}</span></h4>
<div class="description">
Given an OSM street network (graph), return an A* pathfinder that can operate on it.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>graph</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An ngraph graph representing an OSM street network.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="routing.js.html">routing.js</a>, <a href="routing.js.html#line85">line 85</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- An A* pathfinder for the graph.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h4 class="name" id="getStreetFeatures"><span class="type-signature">(private) </span>getStreetFeatures<span class="signature">(OSM_data)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Feature">Feature</a>>}</span></h4>
<div class="description">
Get all streets from the GeoJSON data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>OSM_data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">A GeoJSON Feature Collection object containing the OSM streets inside the bounding box.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line76">line 76</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- array of street features.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</dd>
</dl>
<h4 class="name" id="getUnitAnchors"><span class="type-signature">(private) </span>getUnitAnchors<span class="signature">(street_feature, unit_options)</span><span class="type-signature"> &rarr; {Array.&lt;Array.&lt;<a href="global.html#Feature">Feature</a>>>}</span></h4>
<div class="description">
Find anchors for potential units. chors are the pairs of start
and end points along the street from which units may be constructed.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>street_feature</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Feature">Feature</a></span>
</td>
<td class="description last">A GeoJSON feature object representing a street.</td>
</tr>
<tr>
<td class="name"><code>unit_options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An object containing the AgentMaps styling options for units.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line295">line 295</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Array of pairs of points around which to anchor units along a street.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;Array.&lt;<a href="global.html#Feature">Feature</a>>></span>
</dd>
</dl>
<h4 class="name" id="getUnitFeatures"><span class="type-signature">(private) </span>getUnitFeatures<span class="signature">(OSM_data, unit_options)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Feature">Feature</a>>}</span></h4>
<div class="description">
Get all appropriate units within the desired bounding box.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>OSM_data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">A GeoJSON Feature Collection object containing the OSM features inside the bounding box.</td>
</tr>
<tr>
<td class="name"><code>unit_options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An object containing the AgentMaps styling options for units.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line176">line 176</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- array of features representing real estate units.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</dd>
</dl>
<h4 class="name" id="getUnitNeighborLayerIDs"><span class="type-signature">(private) </span>getUnitNeighborLayerIDs<span class="signature">(neighbors)</span><span class="type-signature"> &rarr; {Array.&lt;?number>}</span></h4>
<div class="description">
Given an array of pre-layer IDs, check if any of them correspond to the pre-layer IDs of unit layers, and if so
return an array of the corresponding layer IDs.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>neighbors</code></td>
<td class="type">
<span class="param-type">Array.&lt;?number></span>
</td>
<td class="description last">An array of pre-layer feature IDs for a unit's neighbors.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line378">line 378</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- An array of Leaflet layer IDs corresponding to the unit's neighbors.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;?number></span>
</dd>
</dl>
<h4 class="name" id="isPointCoordinates"><span class="type-signature"></span>isPointCoordinates<span class="signature">(array)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Given an array, check whether it can represent the coordinates of a point.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>array</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">Array to check.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line36">line 36</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Whether the array can be the coordinates of a point.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="noOverlaps"><span class="type-signature">(private) </span>noOverlaps<span class="signature">(reference_polygon_feature, polygon_feature_array)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Check whether a polygon overlaps with any member of an array of polygons.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>reference_polygon_feature</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Feature">Feature</a></span>
</td>
<td class="description last">A geoJSON polygon feature.</td>
</tr>
<tr>
<td class="name"><code>polygon_feature_array</code></td>
<td class="type">
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</td>
<td class="description last">Array of geoJSON polygon features.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line358">line 358</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Whether the polygon_feature overlaps with any one in the array.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="pointToCoordinateArray"><span class="type-signature"></span>pointToCoordinateArray<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;number>}</span></h4>
<div class="description">
Given either a GeoJSON feature, L.latLng, or coordinate array containing the coordinates of a point,
return an array of the coordinates.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Array of the point's coordinates. I.e.: [lng, lat].
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;number></span>
</dd>
</dl>
<h4 class="name" id="reversedCoordinates"><span class="type-signature"></span>reversedCoordinates<span class="signature">(coordinates)</span><span class="type-signature"> &rarr; {Array.&lt;(number|Array.&lt;(number|Array.&lt;number>)>)>}</span></h4>
<div class="description">
Given a geoJSON geometry object's coordinates, return the object, but with
all the coordinates reversed. <br /point.geometry && point.geometry.coordinates && >
Why? GeoJSON coordinates are in lngLat format by default, while Leaflet uses latLng.
L.geoJSON will auto-reverse the order of a GeoJSON object's coordinates, as it
expects geoJSON coordinates to be lngLat. However, normal, non-GeoJSON-specific Leaflet
methods expect Leaflet's latLng pairs and won't auto-reverse, so we have to do that
manually if we're preprocessing the GeoJSON data before passing it to L.geoJSON.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>coordinates</code></td>
<td class="type">
<span class="param-type">Array.&lt;(number|Array.&lt;(number|Array.&lt;number>)>)></span>
</td>
<td class="description last">GeoJSON coordinates for a point, (multi-)line, or (multi-)polygon.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Reversed geoJSON coordinates for a point, (multi-)line, or (multi-)polygon.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;(number|Array.&lt;(number|Array.&lt;number>)>)></span>
</dd>
</dl>
<h4 class="name" id="setupStreetFeatures"><span class="type-signature"></span>setupStreetFeatures<span class="signature">(OSM_data, street_options)</span><span class="type-signature"></span></h4>
<div class="description">
Generate and setup streets based on the provided GeoJSON data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>OSM_data</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A GeoJSON Feature Collection object containing the OSM features inside the bounding box.</td>
</tr>
<tr>
<td class="name"><code>street_options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An object containing the Leaflet styling options for streets.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line37">line 37</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setupUnitFeatures"><span class="type-signature"></span>setupUnitFeatures<span class="signature">(bounding_box, OSM_data, unit_options)</span><span class="type-signature"></span></h4>
<div class="description">
Generate and setup building units based on the provided GeoJSON data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bounding_box</code></td>
<td class="type">
<span class="param-type">Array.&lt;Array.&lt;number>></span>
</td>
<td class="description last">The map's top-left and bottom-right coordinates.</td>
</tr>
<tr>
<td class="name"><code>OSM_data</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A GeoJSON Feature Collection object containing the OSM features inside the bounding box.</td>
</tr>
<tr>
<td class="name"><code>unit_options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">An object containing the Leaflet & AgentMaps styling options for units.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line131">line 131</a>
</li></ul></dd>
</dl>
<h4 class="name" id="streetsToGraph"><span class="type-signature">(private) </span>streetsToGraph<span class="signature">(streets)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
Convert a layerGroup of streets into a graph.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>streets</code></td>
<td class="type">
<span class="param-type">LayerGroup</span>
</td>
<td class="description last">A Leaflet layerGroup of streets, forming a street network.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="routing.js.html">routing.js</a>, <a href="routing.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- A graph representing the street network, operable by the ngraph pathfinder.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="unitsOutOfStreets"><span class="type-signature">(private) </span>unitsOutOfStreets<span class="signature">(unit_features, street_layers)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Feature">Feature</a>>}</span></h4>
<div class="description">
Get an array of units excluding units that overlap with streets.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>unit_features</code></td>
<td class="type">
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</td>
<td class="description last">Array of features representing units.</td>
</tr>
<tr>
<td class="name"><code>street_layers</code></td>
<td class="type">
<span class="param-type">Array.&lt;Layer></span>
</td>
<td class="description last">Array of Leaflet layers representing streets.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line331">line 331</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- unit_features, but with all units that intersect any streets removed.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="global.html#Feature">Feature</a>></span>
</dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="agentFeatureMaker"><span class="type-signature"></span>agentFeatureMaker<span class="signature">(id)</span><span class="type-signature"> &rarr; {<a href="global.html#Point">Point</a>}</span></h4>
<div class="description">
A user-defined callback function that returns a feature with appropriate geometry and properties to represent an agent.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The agent's Leaflet layer ID.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agents.js.html">agents.js</a>, <a href="agents.js.html#line669">line 669</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- a GeoJSON Point feature with properties and coordinates for the agent, including
a "place" property that will set the agent's initial <a href="global.html#Place">Place</a> and an object "layer_options" property
that will specify the feature's Leaflet options (like its color, size, etc.). All other provided properties
will be transferred to the Agent object once it is created.
See <a href="https://leafletjs.com/reference-1.3.2.html#circlemarker">https://leafletjs.com/reference-1.3.2.html#circlemarker</a> for all possible layer options.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#Point">Point</a></span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>let point = {
"type": "Feature",
"properties": {
"layer_options": {
"color": "red",
"radius": .5,
},
"place": {
"type": "unit",
"id": 89
},
age: 72,
home_city: "LA"
},
"geometry" {
"type": "Point",
"coordinates": [
14.54589,
57.136239
]
}
} </code></pre>
<h4 class="name" id="Feature">Feature</h4>
<div class="description">
A GeoJSON feature object.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Should be "Feature".</td>
</tr>
<tr>
<td class="name"><code>properties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Non-geometric properties of the feature.</td>
</tr>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Geometric properties of the feature (a GeoJSON spec of the feature's geometry).
<h6>Properties</h6>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The feature's GeoJSON geometry type.</td>
</tr>
<tr>
<td class="name"><code>coordinates</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The coordinates specifying the feature's geometry.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line13">line 13</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="http://geojson.org/">http://geojson.org/</a></li>
</ul>
</dd>
</dl>
<h4 class="name" id="LatLng">LatLng</h4>
<div class="description">
Represents a latitude/longitude pair. Preferably an instance of L.LatLng:
<a href="https://leafletjs.com/reference-1.3.2.html#latlng">https://leafletjs.com/reference-1.3.2.html#latlng</a>.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>lat</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">A decimal latitude.</td>
</tr>
<tr>
<td class="name"><code>lng</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">A decimal longitude.</td>
</tr>
<tr>
<td class="name"><code>new_place</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Place">Place</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">A place (unit or street) associated with this LatLng.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line3">line 3</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Place">Place</h4>
<div class="description">
A object describing a location.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Either "street", "unit", or "unanchored".</td>
</tr>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The ID of either a street or unit in the appropriate layer group, if the place is "street" or "unit".</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Point">Point</h4>
<div class="description">
A GeoJSON <a href="global.html#Feature">Feature</a> specifically for individual points.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#Feature">Feature</a></span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry.coordinates</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">A single array with 2 elements: [longitude, latitude].</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Agent.html">Agent</a></li><li><a href="Agentmap.html">Agentmap</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-quickstart.html">quickstart</a></li></ul><h3>Global</h3><ul><li><a href="global.html#addStreetLayerIntersections">addStreetLayerIntersections</a></li><li><a href="global.html#agent">agent</a></li><li><a href="global.html#agentmap">agentmap</a></li><li><a href="global.html#checkEndExcess">checkEndExcess</a></li><li><a href="global.html#checkStartExcess">checkStartExcess</a></li><li><a href="global.html#decodeCoordString">decodeCoordString</a></li><li><a href="global.html#encodeLatLng">encodeLatLng</a></li><li><a href="global.html#generateUnitFeatures">generateUnitFeatures</a></li><li><a href="global.html#getIntersections">getIntersections</a></li><li><a href="global.html#getPathFinder">getPathFinder</a></li><li><a href="global.html#getStreetFeatures">getStreetFeatures</a></li><li><a href="global.html#getUnitAnchors">getUnitAnchors</a></li><li><a href="global.html#getUnitFeatures">getUnitFeatures</a></li><li><a href="global.html#getUnitNeighborLayerIDs">getUnitNeighborLayerIDs</a></li><li><a href="global.html#isPointCoordinates">isPointCoordinates</a></li><li><a href="global.html#noOverlaps">noOverlaps</a></li><li><a href="global.html#pointToCoordinateArray">pointToCoordinateArray</a></li><li><a href="global.html#reversedCoordinates">reversedCoordinates</a></li><li><a href="global.html#setupStreetFeatures">setupStreetFeatures</a></li><li><a href="global.html#setupUnitFeatures">setupUnitFeatures</a></li><li><a href="global.html#streetsToGraph">streetsToGraph</a></li><li><a href="global.html#unitsOutOfStreets">unitsOutOfStreets</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Aug 31 2018 17:53:17 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>