** msOWSGetLayerExtent() ** ** Try to establish layer extent, first looking for "ows_extent" metadata, and ** if not found then call msLayerGetExtent() which will lookup the ** layer->extent member, and if not found will open layer to read extent. ** */
| 1649 | ** |
| 1650 | */ |
| 1651 | int msOWSGetLayerExtent(mapObj *map, layerObj *lp, const char *namespaces, rectObj *ext) |
| 1652 | { |
| 1653 | const char *value; |
| 1654 | |
| 1655 | if ((value = msOWSLookupMetadata(&(lp->metadata), namespaces, "extent")) != NULL) |
| 1656 | { |
| 1657 | char **tokens; |
| 1658 | int n; |
| 1659 | |
| 1660 | tokens = msStringSplit(value, ' ', &n); |
| 1661 | if (tokens==NULL || n != 4) { |
| 1662 | msSetError(MS_WMSERR, "Wrong number of arguments for EXTENT metadata.", |
| 1663 | "msOWSGetLayerExtent()"); |
| 1664 | return MS_FAILURE; |
| 1665 | } |
| 1666 | ext->minx = atof(tokens[0]); |
| 1667 | ext->miny = atof(tokens[1]); |
| 1668 | ext->maxx = atof(tokens[2]); |
| 1669 | ext->maxy = atof(tokens[3]); |
| 1670 | |
| 1671 | msFreeCharArray(tokens, n); |
| 1672 | return MS_SUCCESS; |
| 1673 | } |
| 1674 | else |
| 1675 | { |
| 1676 | return msLayerGetExtent(lp, ext); |
| 1677 | } |
| 1678 | |
| 1679 | return MS_FAILURE; |
| 1680 | } |
| 1681 | |
| 1682 | |
| 1683 | /********************************************************************** |
no test coverage detected