| 2191 | /************************************************************************/ |
| 2192 | |
| 2193 | static int msWCSGetCoverageMetadata20(layerObj *layer, wcs20coverageMetadataObj *cm) |
| 2194 | { |
| 2195 | char *srs_uri = NULL; |
| 2196 | int i = 0; |
| 2197 | if ( msCheckParentPointer(layer->map,"map") == MS_FAILURE ) |
| 2198 | return MS_FAILURE; |
| 2199 | |
| 2200 | if((cm->srs = msOWSGetEPSGProj(&(layer->projection), |
| 2201 | &(layer->metadata), "CO", MS_TRUE)) == NULL) |
| 2202 | { |
| 2203 | if((cm->srs = msOWSGetEPSGProj(&(layer->map->projection), |
| 2204 | &(layer->map->web.metadata), "CO", MS_TRUE)) == NULL) |
| 2205 | { |
| 2206 | msSetError(MS_WCSERR, "Unable to determine the SRS for this layer, " |
| 2207 | "no projection defined and no metadata available.", |
| 2208 | "msWCSGetCoverageMetadata20()"); |
| 2209 | return MS_FAILURE; |
| 2210 | } |
| 2211 | } |
| 2212 | |
| 2213 | /* -------------------------------------------------------------------- */ |
| 2214 | /* Get the SRS in uri format. */ |
| 2215 | /* -------------------------------------------------------------------- */ |
| 2216 | if((srs_uri = msOWSGetProjURI(&(layer->projection), &(layer->metadata), |
| 2217 | "CO", MS_TRUE)) == NULL) |
| 2218 | { |
| 2219 | srs_uri = msOWSGetProjURI(&(layer->map->projection), |
| 2220 | &(layer->map->web.metadata), "CO", MS_TRUE); |
| 2221 | } |
| 2222 | |
| 2223 | if( srs_uri != NULL ) |
| 2224 | { |
| 2225 | if( strlen(srs_uri) > sizeof(cm->srs_uri) - 1 ) |
| 2226 | { |
| 2227 | msSetError(MS_WCSERR, "SRS URI too long!", |
| 2228 | "msWCSGetCoverageMetadata()"); |
| 2229 | return MS_FAILURE; |
| 2230 | } |
| 2231 | |
| 2232 | strlcpy( cm->srs_uri, srs_uri, sizeof(cm->srs_uri) ); |
| 2233 | msFree( srs_uri ); |
| 2234 | } |
| 2235 | else |
| 2236 | { |
| 2237 | cm->srs_uri[0] = '\0'; |
| 2238 | } |
| 2239 | |
| 2240 | /* setup nilvalues */ |
| 2241 | cm->numnilvalues = 0; |
| 2242 | cm->nilvalues = NULL; |
| 2243 | cm->nilvalues_reasons = NULL; |
| 2244 | cm->native_format = NULL; |
| 2245 | |
| 2246 | /* -------------------------------------------------------------------- */ |
| 2247 | /* If we have "virtual dataset" metadata on the layer, then use */ |
| 2248 | /* that in preference to inspecting the file(s). */ |
| 2249 | /* We require extent and either size or resolution. */ |
| 2250 | /* -------------------------------------------------------------------- */ |
no test coverage detected