Opened 15 years ago
Closed 15 years ago
#260 closed defect (fixed)
Geography inconsistent distance behavior from geometry and geography flag counting flaky
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 1.5.0 |
Component: | postgis | Version: | |
Keywords: | Cc: |
Description
Example with new geography - both the ST_Dwithin and ST_Distance fail ERROR: gbox_overlaps: geometries have mismatched dimensionality
Again not really a bug I guess just different from geometry behavior
SELECT ST_DWithin(geography(foo1.the_geom), geography(foo2.the_geom), 100), ST_AsText(foo1.the_geom) As ref1_geom, ST_AsText(foo2.the_geom) As ref2_geom, ST_Distance(geography(foo1.the_geom), (foo2.the_geom)) FROM (( SELECT ST_GeomFromEWKT('SRID=4326;MULTIPOLYGONM(((0 0 2,10 0 1,10 10 -2,0 10 -5,0 0 -5),(5 5 6,7 5 6,7 7 6,5 7 10,5 5 -2)))') As the_geom )) As foo1 CROSS JOIN ((SELECT ST_SetSRID(ST_MakePolygon(ST_AddPoint(ST_AddPoint(ST_MakeLine(ST_MakePoint(i+m,j,m),ST_MakePoint(j+m,i-m,m)),ST_MakePoint(i,j,m)),ST_MakePointM(i+m,j,m))),4326) As the_geom FROM generate_series(-10,50,20) As i CROSS JOIN generate_series(50,70, 20) As j CROSS JOIN generate_series(1,2) As m ORDER BY i, j, i+j+m, m, i*j*m)) As foo2 LIMIT 2;
Example with plain geometry works
SELECT ST_DWithin(foo1.the_geom, foo2.the_geom, 100), ST_AsText(foo1.the_geom) As ref1_geom, ST_AsText(foo2.the_geom) As ref2_geom, ST_Distance(foo1.the_geom, foo2.the_geom) FROM (( SELECT ST_GeomFromEWKT('SRID=4326;MULTIPOLYGONM(((0 0 2,10 0 1,10 10 -2,0 10 -5,0 0 -5),(5 5 6,7 5 6,7 7 6,5 7 10,5 5 -2)))') As the_geom )) As foo1 CROSS JOIN ((SELECT ST_SetSRID(ST_MakePolygon(ST_AddPoint(ST_AddPoint(ST_MakeLine(ST_MakePoint(i+m,j,m),ST_MakePoint(j+m,i-m,m)),ST_MakePoint(i,j,m)),ST_MakePointM(i+m,j,m))),4326) As the_geom FROM generate_series(-10,50,20) As i CROSS JOIN generate_series(50,70, 20) As j CROSS JOIN generate_series(1,2) As m ORDER BY i, j, i+j+m, m, i*j*m)) As foo2 LIMIT 2;
Change History (7)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Okay wrong again. This is definitely broken. Totally broken. the below used to work.
SELECT ST_Distance(ST_GeographyFromText('SRID=4326;POINT(-10 40)'), ST_GeographyFromText('SRID=4326;POINT(-10 55)'));
comment:3 by , 15 years ago
The comment above is fixed. Could you put new issues into new tickets, so I can cleanly close them out? The issues at the very very top, could you reduce to a geometry pair for me?
comment:4 by , 15 years ago
Paul, Sorry about that. I had mistakenly thought they were the same issue since they were generating the same error message. The M x M case works now and so does the POINT, POINT.
So just this first one I started with is inconsistent with geometry ST_Distance and ST_DWithin behavior.
SELECT ST_Distance( ST_GeographyFromText('SRID=4326;MULTIPOLYGONM(((0 0 2,10 0 1,10 10 -2,0 10 -5,0 0 -5),(5 5 6,7 5 6,7 7 6,5 7 10,5 5 -2)))'), ST_GeomFromEWKT('SRID=4326;POLYGON((-8 50 2,52 -12 2,-10 50 2,-8 50 2))'));
comment:5 by , 15 years ago
Typo I meant --
SELECT ST_Distance( ST_GeographyFromText('SRID=4326;MULTIPOLYGONM(((0 0 2,10 0 1,10 10 -2,0 10 -5,0 0 -5),(5 5 6,7 5 6,7 7 6,5 7 10,5 5 -2)))'), ST_GeographyFromText('SRID=4326;POLYGON((-8 50 2,52 -12 2,-10 50 2,-8 50 2))'))
comment:6 by , 15 years ago
Summary: | Geography inconsistent distance behavior from geometry can't compare different dimensonality → Geography inconsistent distance behavior from geometry and geography flag counting flaky |
---|
If we are not going to allow this - gives gbox_overlaps: geometries have mismatched dimensionality:
SELECT ST_Distance(ST_GeographyFromText('SRID=4326;POINT(-10 50)'), ST_GeographyFromText('SRID=4326;LINESTRING(-10 40 1,-9 41 1)'));
Then we certainly shouldn't be allowing this which happens to work.
SELECT ST_Distance(ST_GeographyFromText('SRID=4326;POINT(-10 50 1)'), ST_GeographyFromText('SRID=4326;LINESTRINGM(-10 40 1,-9 41 1)'));
comment:7 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Good god, is there anything you don't test :) fixed at r4633
Though this I would consider a bug (at least an error in the error message). Gives error ERROR: gbox_overlaps: geometries have mismatched dimensionality
even though they are the same dimension. If we are not going to allow these functions to be used with higher dimensions we should change this error message.