| 2592 | |
| 2593 | ST_Transform enables the end-user to reproject a raster to a new projection. Unlike the ST_Transform function for geometries, ST_Transform for rasters depends upon the specificiation of a resampling algorithm and an error tolerance. In addition, reprojecting a raster will probably change the scale of the pixels. Therefore, ST_Transform for rasters can be more involved than the ST_Transform for geometries. |
| 2594 | |
| 2595 | 1. ST_Transform(rast raster, srid integer, algorithm text DEFAULT '!NearestNeighbour', maxerr double precision DEFAULT 0.125, scalex double precision DEFAULT 0, scaley double precision DEFAULT 0) |
| 2596 | |
| 2597 | returns a new raster in the projection specified by "srid" |
| 2598 | |
| 2599 | srid: the SRID of the projection to use when reprojecting the raster |
| 2600 | |
| 2601 | algorithm: the resampling algorithm to use when reprojecting the raster. default is '!NearestNeighbour'. possible algorithms are: |
| 2602 | |
| 2603 | {{{ |
| 2604 | NearestNeighbour (default. fastest performance but worst interpolation) |
| 2605 | |
| 2606 | NearestNeighbor (for those wanting to use the American spelling) |
| 2607 | |
| 2608 | Bilinear |
| 2609 | |
| 2610 | Cubic |
| 2611 | |
| 2612 | CubicSpline |
| 2613 | |
| 2614 | Lanczos |
| 2615 | }}} |
| 2616 | |
| 2617 | maxerr: the threshold for transformation approximation by the resampling algorithm (in pixel units). default is 0.125, which is the same value used in GDAL gdalwarp utility. if set to zero, no approximation takes place. |
| 2618 | |
| 2619 | scalex: the reprojected raster's scale in the X axis. default is 0 indicating that the user isn't specifying the reprojected raster's scale |
| 2620 | |
| 2621 | scaley: the reprojected raster's scale in the Y axis. default is 0 indicating that the user isn't specifying the reprojected raster's scale |
| 2622 | |
| 2623 | {{{ |
| 2624 | ST_Transform(rast, 3310) |
| 2625 | |
| 2626 | ST_Transform(rast, 3310, 'Bilinear') |
| 2627 | |
| 2628 | ST_Transform(rast, 3310, 'Lanczos', 0) |
| 2629 | |
| 2630 | ST_Transform(rast, 3310, 'Lanczos', 0.5) |
| 2631 | |
| 2632 | ST_Transform(rast, 3310, 'Lanczos', 0.125, 1000) |
| 2633 | |
| 2634 | ST_Transform(rast, 3310, 'Lanczos', 0.125, 1000, 1000) |
| 2635 | }}} |
| 2636 | |
| 2637 | 2. ST_Transform(rast raster, srid integer, scalex double precision, scaley double precision, algorithm text DEFAULT '!NearestNeighbour', maxerr double precision DEFAULT 0.125) |
| 2638 | |
| 2639 | {{{ |
| 2640 | ST_Transform(rast, 4326, 500, 500) |
| 2641 | |
| 2642 | ST_Transform(rast, 4326, 500, 500, 'Cubic') |
| 2643 | |
| 2644 | ST_Transform(rast, 4326, 500, 500, 'CubicSpline', 0) |
| 2645 | }}} |
| 2646 | |
| 2647 | 3. ST_Transform(rast raster, srid integer, scalexy double precision, algorithm text DEFAULT '!NearestNeighbour', maxerr double precision DEFAULT 0.125) |
| 2648 | |
| 2649 | scalexy: the reprojected raster's scale in the X and Y axes. default is 0 indicating that the user isn't specifying the reprojected raster's scale |
| 2650 | |
| 2651 | {{{ |
| 2652 | ST_Transform(rast, 4326, 250) |
| 2653 | |
| 2654 | ST_Transform(rast, 4326, 250, 'Cubic') |
| 2655 | |
| 2656 | ST_Transform(rast, 4326, 100, 'CubicSpline', 0) |
| 2657 | }}} |
| 2658 | |