[postgis-devel] [PostGIS] #260: Geography inconsistent distance behavior from geometry can't compare different dimensonality

PostGIS trac at osgeo.org
Wed Oct 7 05:03:16 PDT 2009


#260: Geography inconsistent distance behavior from geometry can't compare
different dimensonality
---------------------+------------------------------------------------------
 Reporter:  robe     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  postgis 1.5.0
Component:  postgis  |     Version:               
 Keywords:           |  
---------------------+------------------------------------------------------
 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;
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/260>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS


More information about the postgis-devel mailing list