pgLatLon

diff README.html @ 46:3cbce515387f

Added safety margins for distance calculation on index lookups (fixes bug that caused nearest-neighbor search to fail in certain cases); Improved "fair_distance" function
author jbe
date Mon Oct 31 13:06:31 2016 +0100 (2016-10-31)
parents 10640afbe2ea
children b37a0dc6d1ec
line diff
     1.1 --- a/README.html	Tue Oct 25 22:15:17 2016 +0200
     1.2 +++ b/README.html	Mon Oct 31 13:06:31 2016 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4 -<html><head><title>pgLatLon v0.9 documentation</title></head><body>
     1.5 -<h1>pgLatLon v0.9 documentation</h1>
     1.6 +<html><head><title>pgLatLon v0.10 documentation</title></head><body>
     1.7 +<h1>pgLatLon v0.10 documentation</h1>
     1.8  
     1.9  <p>pgLatLon is a spatial database extension for the PostgreSQL object-relational
    1.10  database management system providing geographic data types and spatial indexing
    1.11 @@ -40,8 +40,8 @@
    1.12  <p>It is also possible to compile and install the extension without GNU Make as
    1.13  follows:</p>
    1.14  
    1.15 -<pre><code>cc -Wall -O2 -fPIC -shared -I `pg_config --includedir-server` -o latlon-v0008.so latlon-v0008.c
    1.16 -cp latlon-v0008.so `pg_config --pkglibdir`
    1.17 +<pre><code>cc -Wall -O2 -fPIC -shared -I `pg_config --includedir-server` -o latlon-v0009.so latlon-v0009.c
    1.18 +cp latlon-v0009.so `pg_config --pkglibdir`
    1.19  cp latlon.control `pg_config --sharedir`/extension/
    1.20  cp latlon--*.sql `pg_config --sharedir`/extension/
    1.21  </code></pre>
    1.22 @@ -502,23 +502,41 @@
    1.23  following properties:</p>
    1.24  
    1.25  <ul>
    1.26 -<li>For search points far away from the <code>ecluster</code> (i.e. distance approaching
    1.27 -infinity), the penalty approaches zero (i.e. <code>fair_distance</code> behaves the same
    1.28 -as <code>distance</code>).</li>
    1.29 +<li>The penalty function is continuous (except noise created by numerical
    1.30 +integration, see paragraph after this list) as long as no objects are added
    1.31 +to or removed from the <code>ecluster</code>. That particularly means: small changes in
    1.32 +the search point (second argument) cause only small changes in the result.</li>
    1.33 +<li>For search points far away from the <code>ecluster</code> (i.e. large distances compared
    1.34 +to the dimensions of the <code>ecluster</code>), the penalty approaches zero, i.e. the
    1.35 +behavior of the <code>fair_distance</code> function approaches the behavior of the
    1.36 +<code>distance</code> function.</li>
    1.37  <li>If the <code>ecluster</code> consists of a set of points, the penalty for a search point
    1.38 -close to one of that points (closer than half of the minimum distance between
    1.39 -each pair of points in the <code>ecluster</code>) is chosen in such a way that the
    1.40 -adjusted distance is equal to the distance from the search point to the
    1.41 +close to one of those points (closer than half of the minimum distance
    1.42 +between each pair of points in the <code>ecluster</code>) is chosen in such a way that
    1.43 +the adjusted distance is equal to the distance from the search point to the
    1.44  closest point in the <code>ecluster</code> multiplied by the square root of the count of
    1.45  points in the <code>ecluster</code>.</li>
    1.46 +<li>If the <code>ecluster</code> does not cover any area (i.e. only consists of points,
    1.47 +paths, and/or outlines), and if the search point (second argument) overlaps
    1.48 +with the <code>ecluster</code>, then the penalty (and thus the result) is zero.</li>
    1.49 +<li>The integral (or average) of the square of the fair distance value (result of
    1.50 +this function) over all possible search points is independent of the
    1.51 +<code>ecluster</code> as long as the <code>ecluster</code> does not cover more than a half of
    1.52 +earth's surface.</li>
    1.53  </ul>
    1.54  
    1.55 -<p>The function interally uses numerical integration (Monte Carlo like) to compute
    1.56 -the result. The third parameter (which defaults to 10000) can be used to adjust
    1.57 -the number of samples taken. It is ensured that the penalty is always positive,
    1.58 -i.e. results returned by the <code>fair_distance</code> function are always equal to or
    1.59 -greater than the results returned by the <code>distance</code> function regardless of
    1.60 -stochastic effects.</p>
    1.61 +<p>The function uses numerical integration to compute the result. The third
    1.62 +parameter (which defaults to 10000) can be used to adjust the number of samples
    1.63 +taken. A higher sample count increases precision as well as execution time of
    1.64 +the function. Because this function internally uses a spherical model of earth
    1.65 +for certain steps of the calculation, the precision cannot be increased
    1.66 +unboundedly.</p>
    1.67 +
    1.68 +<p>Despite the limitations explained above, it is ensured that the penalty is
    1.69 +always positive, i.e. results returned by the <code>fair_distance</code> function are
    1.70 +always equal to or greater than the results returned by the <code>distance</code>
    1.71 +function regardless of stochastic effects.  Furthermore, all results are
    1.72 +deterministic and reproducible with the same version of pgLatLon.</p>
    1.73  
    1.74  <h4><code>GeoJSON_to_epoint(jsonb, text)</code></h4>
    1.75  

Impressum / About Us