json-odm
Version:
Object document mapper for JSON data that provides mongodb methods for querying and transformation as well as additional joining that is not provided by mongodb. >> IF YOU LIKE IT, PLEASE GIVE IT A STAR ON GITHUB <<
2,163 lines (702 loc) • 27.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Documentation Class: Geo</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Documentation</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="JsonOdm.html">JsonOdm</a></li><li><a href="jsonOdm.Collection.html">jsonOdm.Collection</a></li><li><a href="jsonOdm.Geo.html">jsonOdm.Geo</a></li><li><a href="jsonOdm.Geo.BoundaryBox.html">jsonOdm.Geo.BoundaryBox</a></li><li><a href="jsonOdm.Geo.Feature.html">jsonOdm.Geo.Feature</a></li><li><a href="jsonOdm.Geo.FeatureCollection.html">jsonOdm.Geo.FeatureCollection</a></li><li><a href="jsonOdm.Geo.GeometryCollection.html">jsonOdm.Geo.GeometryCollection</a></li><li><a href="jsonOdm.Geo.LineString.html">jsonOdm.Geo.LineString</a></li><li><a href="jsonOdm.Geo.MultiLineString.html">jsonOdm.Geo.MultiLineString</a></li><li><a href="jsonOdm.Geo.MultiPoint.html">jsonOdm.Geo.MultiPoint</a></li><li><a href="jsonOdm.Geo.MultiPolygon.html">jsonOdm.Geo.MultiPolygon</a></li><li><a href="jsonOdm.Geo.Point.html">jsonOdm.Geo.Point</a></li><li><a href="jsonOdm.Geo.Polygon.html">jsonOdm.Geo.Polygon</a></li><li><a href="jsonOdm.Query.html">jsonOdm.Query</a></li><li><a href="jsonOdm.Util.html">jsonOdm.Util</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<h1 class="page-title">Class: Geo</h1>
<section>
<header>
<h2>
Geo
</h2>
</header>
<article>
<div class="container-overview">
<hr>
<dt>
<h4 class="name" id="Geo"><span class="type-signature"></span>new Geo()</h4>
</dt>
<dd>
<div class="description">
<p>The object to provide geographical data and methods. <br>
<strong style='color:#ff0000'>Warning:</strong> The coordinate reference system is <a href="http://spatialreference.org/ref/epsg/4326/" target="_blank">WGS 84</a>
witch uses the coordinate order [<strong>longitude</strong>,<strong>latitude</strong>]!<br>
Changing the coordinate reference system (CRS) is not supported yet.</p>
</div>
<dl class="details">
</dl>
</dd>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="jsonOdm.Geo.BoundaryBox.html">BoundaryBox</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.Feature.html">Feature</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.FeatureCollection.html">FeatureCollection</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.GeometryCollection.html">GeometryCollection</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.LineString.html">LineString</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.MultiLineString.html">MultiLineString</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.MultiPoint.html">MultiPoint</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.MultiPolygon.html">MultiPolygon</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.Point.html">Point</a></dt>
<dd></dd>
<dt><a href="jsonOdm.Geo.Polygon.html">Polygon</a></dt>
<dd></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<hr>
<dt>
<h4 class="name" id=".detectAsGeometry"><span class="type-signature"><static> </span>detectAsGeometry(geometry)</h4>
</dt>
<dd>
<div class="description">
<p>Takes an array and puts it into a GeoJSON geometry definition. If it geometry already is a valid GeoJSON it will only be returned</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">Array</span>
|
<span class="param-type"><a href="jsonOdm.Geo.BoundaryBox.html">jsonOdm.Geo.BoundaryBox</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.Point.html">jsonOdm.Geo.Point</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.MultiPoint.html">jsonOdm.Geo.MultiPoint</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.LineString.html">jsonOdm.Geo.LineString</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.MultiLineString.html">jsonOdm.Geo.MultiLineString</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.Polygon.html">jsonOdm.Geo.Polygon</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.MultiPolygon.html">jsonOdm.Geo.MultiPolygon</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.GeometryCollection.html">jsonOdm.Geo.GeometryCollection</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
|
<span class="param-type"><a href="jsonOdm.Geo.BoundaryBox.html">jsonOdm.Geo.BoundaryBox</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.Point.html">jsonOdm.Geo.Point</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.MultiPoint.html">jsonOdm.Geo.MultiPoint</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.LineString.html">jsonOdm.Geo.LineString</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.MultiLineString.html">jsonOdm.Geo.MultiLineString</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.Polygon.html">jsonOdm.Geo.Polygon</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.MultiPolygon.html">jsonOdm.Geo.MultiPolygon</a></span>
|
<span class="param-type"><a href="jsonOdm.Geo.GeometryCollection.html">jsonOdm.Geo.GeometryCollection</a></span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".edgeIntersectsBounds"><span class="type-signature"><static> </span>edgeIntersectsBounds(edge, bounds)</h4>
</dt>
<dd>
<div class="description">
<p>Checks whether an edge intersects a boundary box or not</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>edge</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>bounds</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".edgeIntersectsEdge"><span class="type-signature"><static> </span>edgeIntersectsEdge(edge1, edge2 [, allowOnEdge])</h4>
</dt>
<dd>
<div class="description">
<p>Method checks whether an edge intersects another edge</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>edge1</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>A 2-dimensional array holding two vertices representing the edge, i.e. [[1,2],[4,2]]</p></td>
</tr>
<tr>
<td class="name"><code>edge2</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>A 2-dimensional array holding two vertices representing the edge, i.e. [[1,2],[4,2]]</p></td>
</tr>
<tr>
<td class="name"><code>allowOnEdge</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>also counts it as intersection if the edge is on the other edge</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".edgeIntersectsLineString"><span class="type-signature"><static> </span>edgeIntersectsLineString(edge, lineString)</h4>
</dt>
<dd>
<div class="description">
<p>The method checks whether a edge intersects a lineString or not. The polygon will be auto closed</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>edge</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A 2-dimensional array holding two vertices representing the edge, i.e. [[1,2],[4,2]]</p></td>
</tr>
<tr>
<td class="name"><code>lineString</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A line representation i.e. [[1,2],[2,3],[4,4],[1,2]]</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".edgeIntersectsPolygon"><span class="type-signature"><static> </span>edgeIntersectsPolygon(edge, polygon)</h4>
</dt>
<dd>
<div class="description">
<p>The method checks whether a edge intersects a polygon or not. The polygon will be auto closed</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>edge</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A 2-dimensional array holding two vertices representing the edge, i.e. [[1,2],[4,2]]</p></td>
</tr>
<tr>
<td class="name"><code>polygon</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A polygon representation i.e. [[1,2],[2,3],[4,4],[1,2]]</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".edgeWithinPolygon"><span class="type-signature"><static> </span>edgeWithinPolygon(edge, polygon)</h4>
</dt>
<dd>
<div class="description">
<p>The method checks whether a edge is inside a polygon or not. The polygon will be auto closed</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>edge</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A 2-dimensional array holding two vertices representing the edge, i.e. [[1,2],[4,2]]</p></td>
</tr>
<tr>
<td class="name"><code>polygon</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A polygon representation i.e. [[1,2],[2,3],[4,4],[1,2]]</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".lineStringWithinLineString"><span class="type-signature"><static> </span>lineStringWithinLineString(lineString, inLineString)</h4>
</dt>
<dd>
<div class="description">
<p>TODO: ALSO needs to return true for [[1,1],[2,2,]] and [[0,0],[4,4]] // probably needs a rewrite
Checks whether a line follows another line or is on the line respectively</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>lineString</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>An array of points, i.e. [[1,1],[1,2],[1,3]]</p></td>
</tr>
<tr>
<td class="name"><code>inLineString</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>An array of points, i.e. [[1,1],[1,2],[1,3]]</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".pointWithinBounds"><span class="type-signature"><static> </span>pointWithinBounds(point, bounds)</h4>
</dt>
<dd>
<div class="description">
<p>Checks whether a point is inside a boundary box or not</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>point</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>bounds</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".pointWithinLineString"><span class="type-signature"><static> </span>pointWithinLineString(point, lineString)</h4>
</dt>
<dd>
<div class="description">
<p>The method checks whether a point is on a line string path or not.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>point</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A point representation i.e. [1,2]</p></td>
</tr>
<tr>
<td class="name"><code>lineString</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A line string path representation i.e. [[1,2],[2,3],[4,4],[1,2]]</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id=".pointWithinPolygon"><span class="type-signature"><static> </span>pointWithinPolygon(point, polygon)</h4>
</dt>
<dd>
<div class="description">
<p>The method checks whether a point is inside a polygon or not. The polygon will be auto closed</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>point</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A point representation i.e. [1,2]</p></td>
</tr>
<tr>
<td class="name"><code>polygon</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A polygon representation i.e. [[1,2],[2,3],[4,4],[1,2]]</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-3">
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
</div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a>
on July 15th 2016, 4:15:53 pm
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
var id = $( heading ).attr( "id" );
return id && id.replace(/\~/g, '-inner-').replace(/\./g, '-static-') || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>