Skip to content

Commit

Permalink
Ept summary bounds (#3172)
Browse files Browse the repository at this point in the history
* Limit EPT summary bounds to match the behavior of point count when a spatial query is passed. Update docs.

* Remove dangling link from doc.

* Remove curl comment in EPT doc.
  • Loading branch information
connormanning committed Jul 14, 2020
1 parent 5d03cc8 commit 1d9d13d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
12 changes: 9 additions & 3 deletions doc/stages/readers.ept.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ with `Potree`_ or `Plasio`_.
Example
--------------------------------------------------------------------------------

This example downloads a small area around the the Statue of Liberty from the New York City data set (4.7 billion points) which can be viewed in its entirety in `Potree`_ or `Plasio`_.
This example downloads a small area around the the Statue of Liberty from the New York City data set (4.7 billion points) which can be viewed in its entirety in `Potree`_.

.. code-block:: json
Expand Down Expand Up @@ -53,7 +53,7 @@ Options
--------------------------------------------------------------------------------

filename
EPT resource from which to read. Because EPT resources do not have a file extension, to specify an EPT resource as a string, it must be prefixed with ``ept://``. For example, ``pdal translate ept://http://na.entwine.io/autzen autzen.laz``. [Required]
Path to the EPT resource from which to read, ending with ``ept.json``. For example, ``/Users/connor/entwine/autzen/ept.json`` or ``http://na.entwine.io/autzen/ept.json``. [Required]

spatialreference
Spatial reference to apply to the data. Overrides any SRS in the input
Expand Down Expand Up @@ -94,11 +94,18 @@ origin
dimension, which can be determined from the file's position in EPT
metadata file ``entwine-files.json``.

.. note::

When using ``pdal info --summary``, using the ``origin`` option will cause the resulting bounds to be clipped to those of the selected origin, and the resulting number of points to be an upper bound for this selection.

polygon
The clipping polygon, expressed in a well-known text string,
eg: "POLYGON((0 0, 5000 10000, 10000 0, 0 0))". This option can be
specified more than once by placing values in an array.

.. note::

When using ``pdal info --summary``, using the ``polygon`` option will cause the resulting bounds to be clipped to the maximal extents of all provided polygons, and the resulting number of points to be an upper bound for this polygon selection.

threads
Number of worker threads used to download and process EPT data. A
Expand All @@ -107,7 +114,6 @@ threads
.. _Entwine Point Tile: https://entwine.io/entwine-point-tile.html
.. _Entwine: https://entwine.io/
.. _Potree: http://potree.entwine.io/data/nyc.html
.. _Plasio: http://speck.ly/?s=http%3A%2F%2Fc%5B0-7%5D.greyhound.io&r=ept%3A%2F%2Fna.entwine.io%2Fnyc&ca=-0&ce=49.06&ct=-8239196%2C4958509.308%2C337&cd=42640.943&cmd=125978.13&ps=2&pa=0.1&ze=1&c0s=remote%3A%2F%2Fimagery%3Furl%3Dhttp%3A%2F%2Fserver.arcgisonline.com%2FArcGIS%2Frest%2Fservices%2FWorld_Imagery%2FMapServer%2Ftile%2F%7B%7Bz%7D%7D%2F%7B%7By%7D%7D%2F%7B%7Bx%7D%7D.jpg
.. _Schema: https://entwine.io/entwine-point-tile.html#schema

header
Expand Down
21 changes: 19 additions & 2 deletions io/EptReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,9 @@ QuickInfo EptReader::inspect()
for (auto& el : m_info->dims())
qi.m_dimNames.push_back(el.first);

// If we've passed a spatial query, determine an upper bound on the
// point count.
// If there is a spatial query from an explicit --bounds, an origin query,
// or polygons, then we'll limit our number of points to be an upper bound,
// and clip our bounds to the selected region.
if (!m_queryBounds.contains(qi.m_bounds) || m_args->m_polys.size())
{
log()->get(LogLevel::Debug) <<
Expand All @@ -359,9 +360,25 @@ QuickInfo EptReader::inspect()
m_hierarchy.reset(new Hierarchy);
overlaps();

// If we've passed a spatial query, determine an upper bound on the
// point count based on the hierarchy.
qi.m_pointCount = 0;
for (const Overlap& overlap : *m_hierarchy)
qi.m_pointCount += overlap.m_count;

// Also clip the resulting bounds to the intersection of:
// - the query bounds (from an explicit bounds or an origin query)
// - the extents of the polygon selection
qi.m_bounds.clip(m_queryBounds);
if (m_args->m_polys.size())
{
BOX3D b;
for (const auto& poly : m_args->m_polys)
{
b.grow(poly.bounds());
}
qi.m_bounds.clip(b);
}
}
qi.m_valid = true;

Expand Down

0 comments on commit 1d9d13d

Please sign in to comment.