?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<?php 
include "initwebtier.php";
$category = "";
$errorMsg = "";
$status = "";
try {
    echo "<b>Coordinate System API: EnumerateCoordinateSystems</b><br><br>";
    $factory = new MgCoordinateSystemFactory();
    // Get the list of coordinate systems for the specified category
    $category = $_GET['CATEGORY'];
    $systems = $factory->EnumerateCoordinateSystems($category);
    $count = $systems->GetCount();
    echo "<b>Category: </b>{$category}<br>";
    echo "<b>Coordinate Systems: </b>{$count}<br><br>";
    for ($i = 1; $i <= $count; $i++) {
        $system = $systems->GetItem($i - 1);
        echo "<b>Coordinate System {$i}</b><br>";
        printPropertyCollection($system);
        echo "<br>";
    }
    echo "<br>";
    $status = "Pass";
} catch (MgException $e) {
    $errorMsg = $e->GetExceptionMessage();
    $status = "Fail";
} catch (Exception $e) {
Esempio n. 2
0
    if (strpos($data, "Not found") !== false) {
        return null;
    } else {
        return $data;
    }
}
$file = fopen("csmap2proj4.js", "w");
fwrite($file, "/*\n csmap2proj4.js - A Mentor code to proj4 string lookup table\n\n This file was generated by CsMap2Proj.php\n */\n");
$grandTotal = 0;
$mappedTotal = 0;
$csFactory = new MgCoordinateSystemFactory();
$csCategories = $csFactory->EnumerateCategories();
for ($k = 0; $k < $csCategories->GetCount(); $k++) {
    $category = $csCategories->GetItem($k);
    echo ">>> Fetching CS-Map coordinate systems: {$category} <<<\n";
    $csCodes = $csFactory->EnumerateCoordinateSystems($category);
    $mapped = 0;
    $grandTotal += $csCodes->GetCount();
    for ($i = 0; $i < $csCodes->GetCount(); $i++) {
        $csProps = $csCodes->GetItem($i);
        for ($j = 0; $j < $csProps->GetCount(); $j++) {
            $prop = $csProps->GetItem($j);
            if (strcmp(strtolower($prop->GetName()), "code") == 0) {
                try {
                    $csCode = $prop->GetValue();
                    $csWkt = $csFactory->ConvertCoordinateSystemCodeToWkt($csCode);
                    if (strlen(trim($csWkt)) == 0) {
                        echo "Skipping {$csCode}: Empty WKT\n";
                        continue;
                    }
                    $epsg = $csFactory->ConvertWktToEpsgCode($csWkt);