Arguments missing "; exit; } $x1 = $_REQUEST['x1']; $y1 = $_REQUEST['y1']; $x2 = $_REQUEST['x2']; $y2 = $_REQUEST['y2']; $map = new MgMap(); $map->Open($resourceService, $mapName); $srsFactory = new MgCoordinateSystemFactory(); $srs = GetMapSRS($map); $srsMap = $srsFactory->Create($srs); $srsType = $srsMap->GetType(); if ($srsType == MgCoordinateSystemType::Geographic) { $distance = $srsMap->MeasureGreatCircleDistance($x1, $y1, $x2, $y2); } else { $distance = $srsMap->MeasureEuclideanDistance($x1, $y1, $x2, $y2); } $distance = $srsMap->ConvertCoordinateSystemUnitsToMeters($distance); header('Content-type: text/x-json'); header('X-JSON: true'); echo "{distance:$distance}"; exit; } catch (MgException $e) { echo "last error"; echo "ERROR: " . $e->GetMessage() . "\n"; echo $e->GetDetails() . "\n"; echo $e->GetStackTrace() . "\n"; } ?>