| 1 | = RFC 4: Geolocation Arrays = |
| 2 | |
| 3 | Author: Frank Warmerdam[[BR]] |
| 4 | Contact: warmerdam@pobox.com[[BR]] |
| 5 | Status: Development |
| 6 | |
| 7 | == Summary == |
| 8 | |
| 9 | It is proposed that GDAL support an additional mechanism for geolocation |
| 10 | of imagery based on large arrays of points associating pixels and lines |
| 11 | with geolocation coordinates. These arrays would be represented as raster |
| 12 | bands themselves. |
| 13 | |
| 14 | It is common in AVHRR, Envisat, HDF and netCDF data products to distribute |
| 15 | geolocation for raw or projected data in this manner, and current approaches |
| 16 | to representing this as very large numbers of GCPs, or greatly subsampling |
| 17 | the geolocation information to provide more reasonable numbres of GCPs are |
| 18 | inadequate for many applications. |
| 19 | |
| 20 | == Geolocation Domain Metadata == |
| 21 | |
| 22 | Datasets with geolocation information will include the following dataset level |
| 23 | metadata items in the "GEOLOCATION" domain to identify the geolocation arrays, |
| 24 | and the details of the coordinate system and relationship back to the original |
| 25 | pixels and lines. |
| 26 | |
| 27 | * SRS: wkt encoding of spatial reference system. |
| 28 | * X_DATASET: dataset name (defaults to same dataset if not specified) |
| 29 | * X_BAND: band number within X_DATASET. |
| 30 | * Y_DATASET: dataset name (defaults to same dataset if not specified) |
| 31 | * Y_BAND: band number within Y_DATASET. |
| 32 | * Z_DATASET: dataset name (defaults to same dataset if not specified) |
| 33 | * Z_BAND: band number within Z_DATASET. (optional) |
| 34 | * PIXEL_OFFSET: pixel offset into geo-located data of left geolocation pixel |
| 35 | * LINE_OFFSET: line offset into geo-located data of top geolocation pixel |
| 36 | * PIXEL_STEP: each geolocation pixel represents this many geolocated pixels. |
| 37 | * LINE_STEP: each geolocation pixel represents this many geolocated lines. |
| 38 | |
| 39 | In the common case where two of the bands of a dataset are actually |
| 40 | latitude and longitude, and so the geolocation arrays are the same size as |
| 41 | the base image, the metadata might look like: |
| 42 | |
| 43 | {{{ |
| 44 | SRS: GEOGCS... |
| 45 | X_BAND: 2 |
| 46 | Y_BAND: 3 |
| 47 | PIXEL_OFFSET: 0 |
| 48 | LINE_OFFSET: 0 |
| 49 | PIXEL_STEP: 1 |
| 50 | LINE_STEP: 1 |
| 51 | }}} |
| 52 | |
| 53 | For AVHRR datasets, there are only 11 points, but for every line. So |
| 54 | the result for a LAC dataset might look like: |
| 55 | |
| 56 | {{{ |
| 57 | SRS: GEOGCS... |
| 58 | X_DATASET: L1BGCPS:n12gac10bit.l1b |
| 59 | X_BAND: 1 |
| 60 | Y_DATASET: L1BGCPS:n12gac10bit.l1b |
| 61 | Y_BAND: 2 |
| 62 | PIXEL_OFFSET: 25 |
| 63 | LINE_OFFSET: 0 |
| 64 | PIXEL_STEP: 40 |
| 65 | LINE_STEP: 1 |
| 66 | }}} |
| 67 | |
| 68 | This assumes the L1B driver is modified to support the special access |
| 69 | to GCPs as bands using the L1BGCPS: prefix. |
| 70 | |
| 71 | == Updating Drivers == |
| 72 | |
| 73 | |
| 74 | 1. HDF4: Client needs mandate immediate incorporation of geolocation array support in the HDF4 driver (specifially for swath products). (complete) |
| 75 | 2. HDF5: Some HDF5 products include geolocation information that should be handled as arrays. No timetable for update. |
| 76 | 3. AVHRR: Has 11 known location per-scanline. These are currently substantially downsampled and returned as GCPs, but this format would be an excellent canidate for treating as geolocation arrays. Planned in near future. |
| 77 | 4. Envisat: Envisat raw products use geolocation information currently subsampled as GCPs, good candidate for upgrade. No timetable for update. |
| 78 | 5. netCDF: NetCDF files can have differently varying maps in x and y directions which could be represented as geolocation arrays when they are irregular. No timetable for update. |
| 79 | 6. OPeNDAP: Can have differently varying maps in x and y directions which could be represented as geolocation arrays when they are irregular. No timetable for update. |
| 80 | |
| 81 | == Changes to Warp API and gdalwarp == |
| 82 | |
| 83 | Introduce a new geolocation array based transformation method, following the |
| 84 | existing GDALTransformer mechanism. A geolocation array transformer will |
| 85 | be created with the following function call. The "char **" array is the |
| 86 | list of metadata from the GEOLOCATION metadata domain. |
| 87 | |
| 88 | {{{ |
| 89 | void *GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, |
| 90 | char **papszGeolocationInfo, |
| 91 | int bReversed ); |
| 92 | }}} |
| 93 | |
| 94 | This transformer is currently partially implemented, but in a manner that |
| 95 | potentially uses a great deal of memory (twice the memory needed for the |
| 96 | geolocation arrays), and with still dubious correctness, but once approved |
| 97 | this will be fixup up to at least be correct, though likely not efficient for |
| 98 | the time being. |
| 99 | |
| 100 | The GDALGenImgProjTransformer will be upgraded to instantiate the GeoLoc |
| 101 | transformer (instead of an affine, gcp, or rpc transformer) if only |
| 102 | geolocation information is available (done). However, the current |
| 103 | GDALCreateGenImgProjTransformer() function does not provide a mechanism to |
| 104 | select which transformation mechanism is used. So, for instance, if an |
| 105 | affine transform is available it will be used in preference to geolocation |
| 106 | data. If bGCPUseOK is TRUE, gcps will be used in preference to geolocation |
| 107 | data. |
| 108 | |
| 109 | The gdalwarp program currently always sets bGCPUseOK to TRUE so there |
| 110 | is no means for gdalwarp users select use of geolocation data in preference |
| 111 | to gcps. Some modification to gdalwarp may be needed in the future in this |
| 112 | regard. |
| 113 | |
| 114 | == Preserving Geolocation Through Translation == |
| 115 | |
| 116 | ''How do we preserve access to geolocation information when translating |
| 117 | a dataset? Do applications like gdal_translate need special handling? |
| 118 | Placement of the geolocation data in a special metadata domain means it |
| 119 | won't be transferred in default translations.'' |
| 120 | |