[postgis-devel] ST_DistanceCached(geog, geog), ST_DWithinCached(geog, geog)

Paul Ramsey pramsey at opengeo.org
Tue Jun 19 09:03:26 PDT 2012


On Tue, Jun 19, 2012 at 12:30 AM, Nicklas Avén
<nicklas.aven at jordogskog.no> wrote:
> Will the same tree apply to geometry type calculations?
> Will it be difficult to use with geometry?

Different tree, but same principles apply to geometry. It'll be much
easier to do now that I've gotten the caching code generalized a bit
more.

> The difference between geometry and geography, beside the different
> calculation, is that the measured points is stored in geometry for
> st_closestpoint and st_shortestline.
>
> Maybe this is a good time to do something similar also in geography, if
> possible?
> I have seen some wishes for that functionality in geography.

Very possible, since the distance function in geography computes the
nearest point as part of the routine.

P.

> This tree-enhancement will be great to increase the predictability of
> how long time a distance calculation will use. Today it is very
> dependent on how many of the calculations that have intersecting bboxes,
> which can be quite annoying.
>
> /Nicklas
>
>
> Is On Mon, 2012-06-18 at 20:46 -0700, Paul Ramsey wrote:
>> I've temporarily committed two functions to Geography support in trunk,
>>
>> ST_DistanceCached(geog, geog)
>> ST_DWithinCached(geog, geog, double)
>>
>> These would take over from ST_Distance(geog, geog) and
>> ST_DWithin(geog, geog, double) when good behavior, performance are
>> confirmed. The only difference between them and their antecedants is
>> that they try and cache an internal geography tree. This seems to make
>> a massive, monster difference for distance calculations. Oddly, I
>> haven't been able to demonstrate a speed difference in DWithin yet, at
>> least not with fairly small tolerance values.
>>
>> Please feel free to test and let me know how things go.
>>
>> P.
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>>
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list