| 78 | === Addendum === |
| 79 | |
| 80 | When we came to implement this proposal, it became apparent that we would achieve better results by generating the grid in the raster coordinate system and transforming it into the map coordinate system, rather than the other way round (as originally proposed). A description of the new method follows: |
| 81 | |
| 82 | In Figure 1, the blue rectangle represents the current map (or viewport) extents. The extents are converted from the map coordinate system into the raster coordinate system in order to determine the new extents in the raster CS (green rectangle). |
| 83 | |
| 84 | ||[[Image(MapToLayerCS.png)]]|| |
| 85 | ||Figure 1. Conversion of map (or viewport) extents into raster coordinate system.|| |
| 86 | |
| 87 | The intersection of the raster extents (pink) with the map extents (green) is then calculated in the raster coordinate system. And this part of the raster image is retrieved from the provider (yellow). |
| 88 | |
| 89 | ||[[Image(MapRasterIntersection.png)]]|| |
| 90 | ||Figure 2. Intersection of map and raster in raster CS.|| |
| 91 | |
| 92 | The raster image is then divided into a mesh of tesselating triangles. The vertices of the mesh are transformed from raster pixel coordinates into the raster coordinate system coordinates, then into the map (or viewport) coordinate system coordinates, and finally into map pixel coordinates, to create a transformed non-uniform mesh. Each triangle from the source raster is then rendered into the corresponding triangular section in the destination mesh to produce the transformed raster image. |
| 93 | |
| 94 | ||[[Image(MeshReprojection.png)]]|| |
| 95 | ||Figure 3. The raster image is rendered into the viewport using the transformation mesh.|| |