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

PostGIS trac at osgeo.org
Sat Oct 10 10:46:53 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:               
Resolution:           |    Keywords:               
----------------------+-----------------------------------------------------
Comment (by robe):

 I thought this may be a rounding issue, but my polygon astext rep in both
 cases seems the same.  Strangely converting
 geometry->geography->geometry->geography maintains ST_covers (also tried
 with an ST_DWithin super small margin).

 But geometry->geography->geometry ST_Intersects -- my boundary point no
 longer intersects.


 {{{
 SELECT ST_AsText(geometry(geography(poly.the_geom))) As wkt,
         ST_AsText(geography(poly.the_geom)) As wkt_geog,
 ST_Intersects(geometry(geography(poly.the_geom)),
 ST_GeomFromText('POINT(-119.5434 34.9438)',4326) ) As convintpt,
 ST_Covers(geography(geometry(geography(poly.the_geom) ) ),
 geography(geometry(ST_GeographyFromText('SRID=4326;POINT(-119.5434
 34.9438)')))) As cov,
         ST_Intersects(poly.the_geom, ST_GeomFromText('POINT(-119.5434
 34.9438)',4326) ) As pintpt

 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;
 }}}


 Yields:


 {{{
                                         wkt
     |                                      wkt_geog
          | convintpt | cov | pintpt
 --------------------------------------------------------------------------------
 ----+---------------------------------------------------------------------------
 ---------+-----------+-----+--------
  POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434
 34.943
 8)) | POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452
 34.9442,-119.5434 3
 4.9438)) | f         | t   | t
 }}}

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


More information about the postgis-devel mailing list