Opened 15 years ago
Closed 15 years ago
#258 closed defect (fixed)
ST_HausdorffDistance crashes server
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 1.5.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
This might be a GEOS problem so not really sure. I'm running the latest trunk GEOS with PostgreSQL 8.4 on windows and latest PostGIS 1.5 trunk.
This crashes server. If I leave out hausdorff works fine so must be something in the ST_HausdorffDistance that is doing it.
SELECT ST_HausdorffDistance(foo1.the_geom, foo2.the_geom), ST_AsEWKT(foo1.the_geom) As ref1_geom, ST_AsEWKT(foo2.the_geom) As ref2_geom
FROM ((SELECT ST_SetSRID(ST_Point(i,j),4326) As the_geom
FROM generate_series(-10,50,15) As i
CROSS JOIN generate_series(40,70, 15) j ORDER BY i,j )) As foo1 CROSS JOIN ((SELECT ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j*0.05) As the_geom
FROM generate_series(-10,50,10) As i
CROSS JOIN generate_series(40,70, 20) As j ORDER BY i, i*j, j)) As foo2 LIMIT 2;
Change History (9)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Strk,
I think this may actually be a PostGIS bug or a more sinister problem you see if you run more than one at a time. I just tried and the thing is is that if I exercise each one individually, it doesn't break, but if I run the query it does.
So run individually:
SELECT ST_HausdorffDistance(ST_GeomFromText('POINT(-10 40)'), ST_GeomFromText('POLYGON((-7 60,-7.05764415879031 59.4147290339516,-7.22836140246614 58.8519497029047,-7.50559116309236 58.3332893009412,-7.87867965644036 57.8786796564404,-8.33328930094119 57.5055911630924,-8.85194970290473 57.2283614024661,-9.41472903395161 57.0576441587903,-9.99999999999999 57,-10.5852709660484 57.0576441587903,-11.1480502970953 57.2283614024661,-11.6667106990588 57.5055911630924,-12.1213203435596 57.8786796564404,-12.4944088369076 58.3332893009412,-12.7716385975339 58.8519497029047,-12.9423558412097 59.4147290339516,-13 60,-12.9423558412097 60.5852709660484,-12.7716385975339 61.1480502970953,-12.4944088369076 61.6667106990588,-12.1213203435597 62.1213203435596,-11.6667106990588 62.4944088369076,-11.1480502970953 62.7716385975339,-10.5852709660484 62.9423558412097,-10 63,-9.41472903395163 62.9423558412097,-8.85194970290474 62.7716385975339,-8.3332893009412 62.4944088369076,-7.87867965644036 62.1213203435596,-7.50559116309237 61.6667106990588,-7.22836140246614 61.1480502970953,-7.05764415879031 60.5852709660484,-7 60))') ); SELECT ST_HausdorffDistance(ST_GeomFromText('POINT(-10 40)'), ST_GeomFromText('POLYGON((-7 60,-7.05764415879031 59.4147290339516,-7.22836140246614 58.8519497029047,-7.50559116309236 58.3332893009412,-7.87867965644036 57.8786796564404,-8.33328930094119 57.5055911630924,-8.85194970290473 57.2283614024661,-9.41472903395161 57.0576441587903,-9.99999999999999 57,-10.5852709660484 57.0576441587903,-11.1480502970953 57.2283614024661,-11.6667106990588 57.5055911630924,-12.1213203435596 57.8786796564404,-12.4944088369076 58.3332893009412,-12.7716385975339 58.8519497029047,-12.9423558412097 59.4147290339516,-13 60,-12.9423558412097 60.5852709660484,-12.7716385975339 61.1480502970953,-12.4944088369076 61.6667106990588,-12.1213203435597 62.1213203435596,-11.6667106990588 62.4944088369076,-11.1480502970953 62.7716385975339,-10.5852709660484 62.9423558412097,-10 63,-9.41472903395163 62.9423558412097,-8.85194970290474 62.7716385975339,-8.3332893009412 62.4944088369076,-7.87867965644036 62.1213203435596,-7.50559116309237 61.6667106990588,-7.22836140246614 61.1480502970953,-7.05764415879031 60.5852709660484,-7 60))') ); SELECT ST_HausdorffDistance(ST_GeomFromText('POINT(-10 55)'), ST_GeomFromText('POLYGON((-7 60,-7.05764415879031 59.4147290339516,-7.22836140246614 58.8519497029047,-7.50559116309236 58.3332893009412,-7.87867965644036 57.8786796564404,-8.33328930094119 57.5055911630924,-8.85194970290473 57.2283614024661,-9.41472903395161 57.0576441587903,-9.99999999999999 57,-10.5852709660484 57.0576441587903,-11.1480502970953 57.2283614024661,-11.6667106990588 57.5055911630924,-12.1213203435596 57.8786796564404,-12.4944088369076 58.3332893009412,-12.7716385975339 58.8519497029047,-12.9423558412097 59.4147290339516,-13 60,-12.9423558412097 60.5852709660484,-12.7716385975339 61.1480502970953,-12.4944088369076 61.6667106990588,-12.1213203435597 62.1213203435596,-11.6667106990588 62.4944088369076,-11.1480502970953 62.7716385975339,-10.5852709660484 62.9423558412097,-10 63,-9.41472903395163 62.9423558412097,-8.85194970290474 62.7716385975339,-8.3332893009412 62.4944088369076,-7.87867965644036 62.1213203435596,-7.50559116309237 61.6667106990588,-7.22836140246614 61.1480502970953,-7.05764415879031 60.5852709660484,-7 60))') ); SELECT ST_HausdorffDistance(ST_GeomFromText('POINT(-10 55)'), ST_GeomFromText('POLYGON((-7 60,-7.05764415879031 59.4147290339516,-7.22836140246614 58.8519497029047,-7.50559116309236 58.3332893009412,-7.87867965644036 57.8786796564404,-8.33328930094119 57.5055911630924,-8.85194970290473 57.2283614024661,-9.41472903395161 57.0576441587903,-9.99999999999999 57,-10.5852709660484 57.0576441587903,-11.1480502970953 57.2283614024661,-11.6667106990588 57.5055911630924,-12.1213203435596 57.8786796564404,-12.4944088369076 58.3332893009412,-12.7716385975339 58.8519497029047,-12.9423558412097 59.4147290339516,-13 60,-12.9423558412097 60.5852709660484,-12.7716385975339 61.1480502970953,-12.4944088369076 61.6667106990588,-12.1213203435597 62.1213203435596,-11.6667106990588 62.4944088369076,-11.1480502970953 62.7716385975339,-10.5852709660484 62.9423558412097,-10 63,-9.41472903395163 62.9423558412097,-8.85194970290474 62.7716385975339,-8.3332893009412 62.4944088369076,-7.87867965644036 62.1213203435596,-7.50559116309237 61.6667106990588,-7.22836140246614 61.1480502970953,-7.05764415879031 60.5852709660484,-7 60))') );
Works fine -- well I don't know if the numbers are right but doesn't break (returns 8 or 23);
But run together - crash of death so bad that I have to manually restart the PostgreSQL service:
SELECT ST_HausdorffDistance(foo1.the_geom, foo2.the_geom ) FROM (VALUES (ST_GeomFromText('POINT(-10 40)') ), ( ST_GeomFromText('POINT(-10 55)') ) ) As foo1(the_geom) CROSS JOIN ( VALUES ( ST_GeomFromText('POLYGON((-7 60,-7.05764415879031 59.4147290339516,-7.22836140246614 58.8519497029047,-7.50559116309236 58.3332893009412,-7.87867965644036 57.8786796564404,-8.33328930094119 57.5055911630924,-8.85194970290473 57.2283614024661,-9.41472903395161 57.0576441587903,-9.99999999999999 57,-10.5852709660484 57.0576441587903,-11.1480502970953 57.2283614024661,-11.6667106990588 57.5055911630924,-12.1213203435596 57.8786796564404,-12.4944088369076 58.3332893009412,-12.7716385975339 58.8519497029047,-12.9423558412097 59.4147290339516,-13 60,-12.9423558412097 60.5852709660484,-12.7716385975339 61.1480502970953,-12.4944088369076 61.6667106990588,-12.1213203435597 62.1213203435596,-11.6667106990588 62.4944088369076,-11.1480502970953 62.7716385975339,-10.5852709660484 62.9423558412097,-10 63,-9.41472903395163 62.9423558412097,-8.85194970290474 62.7716385975339,-8.3332893009412 62.4944088369076,-7.87867965644036 62.1213203435596,-7.50559116309237 61.6667106990588,-7.22836140246614 61.1480502970953,-7.05764415879031 60.5852709660484,-7 60))' ) ), ( ST_GeomFromText('POLYGON((-7 60,-7.05764415879031 59.4147290339516,-7.22836140246614 58.8519497029047,-7.50559116309236 58.3332893009412,-7.87867965644036 57.8786796564404,-8.33328930094119 57.5055911630924,-8.85194970290473 57.2283614024661,-9.41472903395161 57.0576441587903,-9.99999999999999 57,-10.5852709660484 57.0576441587903,-11.1480502970953 57.2283614024661,-11.6667106990588 57.5055911630924,-12.1213203435596 57.8786796564404,-12.4944088369076 58.3332893009412,-12.7716385975339 58.8519497029047,-12.9423558412097 59.4147290339516,-13 60,-12.9423558412097 60.5852709660484,-12.7716385975339 61.1480502970953,-12.4944088369076 61.6667106990588,-12.1213203435597 62.1213203435596,-11.6667106990588 62.4944088369076,-11.1480502970953 62.7716385975339,-10.5852709660484 62.9423558412097,-10 63,-9.41472903395163 62.9423558412097,-8.85194970290474 62.7716385975339,-8.3332893009412 62.4944088369076,-7.87867965644036 62.1213203435596,-7.50559116309237 61.6667106990588,-7.22836140246614 61.1480502970953,-7.05764415879031 60.5852709660484,-7 60))' ) ) ) As foo2(the_geom);
comment:3 by , 15 years ago
comment:4 by , 15 years ago
That's kind of what I was thinking too that there is something more fundamentally wrong with functions that take two geometry argument. I was going to take out hausdorf from my tests and see if others crash. I had an error in my logic in my xsl (which I forget when I accidentally introduced), so I may have not been testing the 2 arg functions consistently unless they returned a geometry.
comment:5 by , 15 years ago
Hmmmm - works fine for me (Debian Lenny, 64-bit) with latest GEOS trunk and PostGIS trunk. If you're versions of everything are also up to date, it could possibly be a platform/word-size specific issue...
ATB,
Mark.
comment:6 by , 15 years ago
yap my stuff is up to date as of yesterday. I'll try to test on my OpenSUSE.
What about hte LineCrossingDirection issue in #241, does that crash for you too or work fine?
comment:7 by , 15 years ago
Hmmm it chucks a "ERROR: Operation on mixed SRID geometries" message at me. That tends to indicate some kind of memory clobber on the geometry somewhere...
ATB,
Mark.
if you get to the actual geoms I can take a look at the GEOS side (which lacks automated tests for HausdorffDistance btw)