| 167 | == Projecting == |
| 168 | |
| 169 | Not included in this example is the following implementation of the spatial collection interface: |
| 170 | |
| 171 | {{{ |
| 172 | #!C |
| 173 | SPATIAL_COLLECTION * |
| 174 | sc_create_projection_wrapper(SPATIAL_COLLECTION *wrapped, |
| 175 | int32_t desired_srid, |
| 176 | projPJ wrapped_proj, projPJ desired_proj ); |
| 177 | void sc_destroy_projection_wrapper(SPATIAL_COLLECTION *dead); |
| 178 | }}} |
| 179 | |
| 180 | Note again that we write and maintain only ''one'' version of the projection code. Because it is the query point which is projected (and not the base data from which the collection is derived), we need not be concerned with the nature of the base data. Wrap your spatial object with a collection, project the collection, then move on. |
| 181 | |
| 182 | The constructor shown requires that you pass in a `projPJ` object because it is included in the `liblwgeom` library which does not have access to the `spatial_ref_sys` table in the database. It would be possible (and desirable) to put another constructor in the `libpgcommon` library which could generate a `projPJ` object based on the srid. |
| 183 | |