[postgis-devel] [PostGIS] #263: Casting from geography to geometry Huh?

PostGIS trac at osgeo.org
Sat Oct 10 09:54:03 PDT 2009


#263: Casting from geography to geometry Huh?
---------------------+------------------------------------------------------
 Reporter:  robe     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  postgis 1.5.0
Component:  postgis  |     Version:               
 Keywords:           |  
---------------------+------------------------------------------------------
 I can't figure out what is wrong here but this suggests something is wrong
 with our casting from geography to geometry:

 {{{
 SELECT ST_AsEWKT(geometry(geography(pt.the_geom))) As wkt,
         ST_Covers(
                 ST_Transform(poly.the_geom,32611),
                 ST_Transform(pt.the_geom,32611)) As utm,
         ST_Covers(
                 poly.the_geom,
                 pt.the_geom)
          As pca,
         ST_Covers(geometry(geography(poly.the_geom)),
                 geometry(geography(pt.the_geom))) As gm_to_gg_gm_pca

 FROM (SELECT ST_GeomFromEWKT('SRID=4326;POLYGON((-119.5434
 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As
 the_geom)
         As poly
     CROSS JOIN
         (VALUES
                 ( ST_GeomFromEWKT('SRID=4326;POINT(-119.5434 34.9438)') )
 ,
                 ( ST_GeomFromEWKT('SRID=4326;POINT(-119.5452 34.9442)') )
 ,
                 ( ST_GeomFromEWKT('SRID=4326;POINT(-119.5434 34.9438)') ),
                 ( ST_GeomFromEWKT('SRID=4326;POINT(-119.5438 34.9443)')  )
         )
         As pt(the_geom);
 }}}


 Results in:

 {{{
                 wkt                 | utm | pca | gm_to_gg_gm_pca
 ------------------------------------+-----+-----+-----------------
  SRID=4326;POINT(-119.5434 34.9438) | t   | t   | f
  SRID=4326;POINT(-119.5452 34.9442) | t   | t   | f
  SRID=4326;POINT(-119.5434 34.9438) | t   | t   | f
  SRID=4326;POINT(-119.5438 34.9443) | t   | t   | f
 }}}

 Shouldn't pca and gm_to_gg_gm_pca yield the same answer. How do I lose my
 covers by converting back to geometry.   Inquiring minds want to know.

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


More information about the postgis-devel mailing list