[postgis-devel] Issue 146 in postgis: 1.4 ST_Distance and ST_Dwithin doesn't handle collections correctly

Paragon Corporation lr at pcorp.us
Sun Apr 5 10:28:47 PDT 2009


Niklas,

Welcome from me too.  It was actually because of you that I discovered this
bug since I was comparing your version with the output I got from the 1.4
branch and noticed they both errored out.  Then I checked the tests on 1.3
and noticed they were different.

I had designed this test to check for major crashers and wasn’t diffing
against past versions as I probably should do to catch more of these changes
in behavior.  So its sort of a machine gun sort of test to make up for the
fact that most of our functions have no unit tests or that the unit tests
can't think of all of the possible goofy ways people will use the functions.
I think with a bit more effort I could make it more useful by doing true
diff compares between functions that are the same as the old version.

Anyrate if you want to give it a try to build a unit test, it might be a
good first start.  It pulls all the function signatures from the user docs
and does a cross join against a garden variety of all the geometries we
support defined in the .xsl file (so in case of distance every type of
geometry is tested against every type of other geometry in a goofy sort of
way).  So some tests really aren't meant to work.

Attached is a zip file of my generated test harness, but you can generate
one yourself if you have xsltproc or some sort of xslt processor and even
modify the geometries being tested.  The files are in the
docs/xsl/postgis_gardentest.sql.xsl and it transforms the reference.xml
into test sql statements to test all the documented functions.

Thanks,
Regina



-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Sunday, April 05, 2009 1:03 PM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] Issue 146 in postgis: 1.4 ST_Distance and
ST_Dwithin doesn't handle collections correctly

Niklas,

First of all, welcome to the PostGIS community. I appreciate your energy and
enthusiasm, and willingness to prepare patches.

I have modified your patch and applied it. I had to modify it, because it
contained an error in the logic, which you'll see when you review the change
history. This is going to sound funny coming from me (commit first, ask
questions later), but: I think you're working a bit too fast.  You keep
attaching patches, then re-patching them for issues, and so on: it makes
committers (well, it makes me) very leery about ever applying them (without
going through them with a fine-toothed comb, which is equivalent to writing
them ourselves, timewise).

Fortunately, there is a solution for people like you and me (people in a
hurry): unit testing.  As an example, I have added a file to the cunit test
harness specifically for distance tests and then used it to verify (somewhat
(you'll see I only test variants of collections of
POINT)) that the patch works.  For this spatial database work, we have lots
of combinatoric possibilities that need to be checked (POINT vs POLY,
COLLECTION vs LINE, etc) and building out those possibilities in the test
suite ahead of time both lets us feel confident in our work, and to make
changes knowing that if we break something, we won't apply that change and
let it out into general circulation.

I'd suggest that for your new features or big re-workings you start putting
together a cunit test suite so you can test every facet of them.

Thanks again for the patches and your energy and enthusiasm,

Paul

On Sun, Apr 5, 2009 at 5:10 AM,  <codesite-noreply at google.com> wrote:
>
> Comment #3 on issue 146 by post... at jordogskog.no: 1.4 ST_Distance and 
> ST_Dwithin doesn't handle collections correctly
> http://code.google.com/p/postgis/issues/detail?id=146
>
> Hallo
>
> I found a bug in measures.c
> It could handle collections and mult as the first incomming geometry 
> but not the second. I think this patch solves it :-) /Nicklas Avén
>
> Attachments:
>        st_distance_bugfix.patch  649 bytes
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: torturetest.zip
Type: application/x-zip-compressed
Size: 541167 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20090405/44444c8f/attachment.bin>


More information about the postgis-devel mailing list