[postgis-tickets] [PostGIS] #2229: [raster] Instability with st_intersection/st_intersects

PostGIS trac at osgeo.org
Wed Mar 13 07:22:46 PDT 2013


#2229: [raster] Instability with st_intersection/st_intersects
--------------------+-------------------------------------------------------
 Reporter:  kib     |       Owner:  dustymugs
     Type:  defect  |      Status:  new      
 Priority:  high    |   Milestone:           
Component:  raster  |     Version:  2.0.x    
 Keywords:          |  
--------------------+-------------------------------------------------------

Comment(by kib):

 Replying to [comment:13 pracine]:
 > This happens because ST_Intersection() return less polygons for one
 raster because it returns neigbour pixel sharing a same value as only one
 polygon. Use ST_PixelAsPolygons(ST_Clip(d52_2012112701_4.rast, pos.geom))
 instead of ST_Intersection(d52_2012112701_4.rast, pos.geom)...

 Cool that works - and does sort fine too!

 ||       lon       ||  lat  ||   current_dir   ||   current_speed    ||
 || 14.7918498789346|| 54.825||                null||
 null||
 || 14.7918498789346|| 54.875||                null||
 null||
 || 14.7918498789346|| 54.925||                null||
 null||
 || 14.7918498789346|| 54.975||                null||
 null||
 || 14.8751840193705|| 54.825|| 57.5229305513203|| 0.0245266498532146||
 || 14.8751840193705|| 54.875|| 31.0229305513203|| 0.0245266498532146||
 || 14.8751840193705|| 54.925|| 2.64793055132031|| 0.0167141498532146||
 || 14.8751840193705|| 54.975||  330.39793055132|| 0.0108547748532146||
 || 14.9585181598063|| 54.825|| 52.8979305513203|| 0.0186672748532146||
 || 14.9585181598063|| 54.875|| 22.5229305513203|| 0.0225735248532146||
 || 14.9585181598063|| 54.925||  351.39793055132|| 0.0206203998532146||
 || 14.9585181598063|| 54.975||  346.27293055132|| 0.0128078998532146||
 ||(12 rows)||

 A little strange though with the null values:
 {{{
 select ST_X(g.geom) as lon,
 ST_Y(g.geom) as lat,
 ST_Value(d1142_2013031301_4.rast,1,g.geom) as "current-dir",
 ST_Value(d1142_2013031301_5.rast,1,g.geom) as "current-speed"
 from d1142_2013031301_4
 join d1142_2013031301_5 using (rid)
 CROSS JOIN (VALUES (ST_GeomFromText('POINT(14.79 54.825)',4326))) As
 g(geom)
 where ST_Intersects(d1142_2013031301_4.rast, g.geom)
 order by lon, lat;

   lon  │  lat   │   current-dir    │   current-speed
 ───────┼────────┼──────────────────┼────────────────────
  14.79 │ 54.825 │ 79.7729305513203 │ 0.0284328998532146
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2229#comment:17>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list