Name

ST_SetValue — 입력한 columnx, rowy 픽셀 또는 특정 도형과 교차하는 픽셀들의 위치의 밴드 값을 설정해서 나온 수정된 래스터를 반환합니다. 밴드 번호는 1부터 시작하며, 따로 설정하지 않을 경우 1로 가정합니다.

Synopsis

raster ST_SetValue(raster rast, integer bandnum, geometry geom, double precision newvalue);

raster ST_SetValue(raster rast, geometry geom, double precision newvalue);

raster ST_SetValue(raster rast, integer bandnum, integer columnx, integer rowy, double precision newvalue);

raster ST_SetValue(raster rast, integer columnx, integer rowy, double precision newvalue);

설명

Returns modified raster resulting from setting the specified pixels' values to new value for the designated band given the raster's row and column or a geometry. If no band is specified, then band 1 is assumed.

개선 사항: 2.1.0 버전부터 ST_SetValue() 함수의 도형 변종이 포인트뿐만이 아니라 모든 도형 유형을 지원합니다. 이 도형 변종은 ST_SetValues()의 geomval[] 변종을 감싸는 래퍼(wrapper)입니다.

예시

-- Geometry example
SELECT (foo.geomval).val, ST_AsText(ST_Union((foo.geomval).geom))
FROM (SELECT ST_DumpAsPolygons(
        ST_SetValue(rast,1,
                ST_Point(3427927.75, 5793243.95),
                50)
            ) As geomval
FROM dummy_rast
where rid = 2) As foo
WHERE (foo.geomval).val < 250
GROUP BY (foo.geomval).val;

 val |                                                     st_astext
-----+-------------------------------------------------------------------
  50 | POLYGON((3427927.75 5793244,3427927.75 5793243.95,3427927.8 579324 ...
 249 | POLYGON((3427927.95 5793243.95,3427927.95 5793243.85,3427928 57932 ...

                
-- Store the changed raster --
    UPDATE dummy_rast SET rast = ST_SetValue(rast,1, ST_Point(3427927.75, 5793243.95),100)
        WHERE rid = 2   ;

                

참고

ST_Value, ST_DumpAsPolygons