Example #1
0
/**
 * Get mapshup layer info from an XML document
 */
function getLayerInfosFromXML($doc)
{
    /*
     * Get layer type
     */
    $type = getLayerType($doc);
    /*
     * Set default $infos array values
     */
    $infos = array('type' => $type, 'title' => null, 'description' => null);
    /*
     * Pleiades
     */
    if ($type === "Pleiades") {
        return array('type' => 'Pleiades', 'title' => $doc->getElementsByTagName('DATASET_NAME')->item(0)->nodeValue, 'description' => $doc->getElementsByTagName('METADATA_PROFILE')->item(0)->nodeValue);
    } else {
        if ($type === "OpenSearch") {
            /*
             * Two cases : the OpenSearch description can be an OpenSearch catalog or an OpenSearch service
             * We assume that OpenSearch description is an OpenSearch service unless the description contains
             * an <Url> template containing an 'mspdesc' or an 'jeodesc' attribute in which case it is considered
             * as an OpenSearch catalog
             */
            $isCatalog = false;
            $urls = $doc->getElementsByTagname('Url');
            foreach ($urls as $url) {
                $rel = $url->getAttribute('rel');
                if ($rel === "mspdesc" || $rel === "jeobdesc") {
                    $isCatalog = true;
                    break;
                }
            }
            /*
             * Set title and description
             */
            $infos['title'] = $doc->getElementsByTagName('ShortName')->item(0)->nodeValue;
            $infos['description'] = $doc->getElementsByTagName('Description')->item(0)->nodeValue;
            if ($isCatalog) {
                // Change the type to "Catalog" and extract the connector name
                $infos['type'] = "Catalog";
                $infos['extras'] = array('connectorName' => "OpenSearch");
            } else {
                $infos['type'] = "OpenSearch";
            }
            return $infos;
        }
    }
    return $infos;
}
Example #2
0
  case 'getmaxzoom':
    require_once("mapdata.php");
    $table=$_REQUEST['layer_name'];
    $result=getMaxZoomLevel($table);
    print $result;
    break;

  case 'getlayerextent':
    require_once("mapdata.php");
    $table=$_REQUEST['layer_name'];
    $fids='';
    if (isset($_REQUEST['fids'])) {
      $fids=$_REQUEST['fids'];
    }
    $layertype=getLayerType($table);
    if ($fids != '') {
      print getLayerExtent($table, $layertype, $fids);
    }
    else {
      print getLayerExtent($table, $layertype);
    }

    break;

  case 'getfeaturecount':
    require_once("mapdata.php");
    $table=$_REQUEST['layer_name'];
    $result=getFeatureCountForLayer($table);
    print $result;
    break;