char_decode(stripslashes($filter)));
#echo $req;
#$e = new mb_exception(urldecode($req));
$mygml = new gml3();
#$auth = array();
#$auth['username'] = $authUserName;
#$auth['password'] = $authUserPassword;
#$auth['auth_type'] = "basic";
$mygml->parseFile($req);
#$mygml->parseGeometry($req);
header("Content-type:application/x-json; charset=utf-8");
$geoJson = $mygml->toGeoJSON();
$jsonObj = json_decode($geoJson);
return $jsonObj;
}
if($command == "getGmkNr") {
$searchString = $_REQUEST['term'];
$pattern = "/[a-z0-9]/i";
if (!preg_match($pattern, $searchString)) {
echo "Ungültiger Suchbegriff";
die();
}
$searchFeaturetype = $featuretypeGmkNr;
$filter = '
' . $gmkNrAttr . '
*' . $searchString . '*
';
$resultObj = getGeoJson($searchFeaturetype, $filter);
$resultArray = array();
foreach($resultObj->features as $feature) {
$resultArray[] = array (
"id" => $feature->properties->ID,
"label" => $feature->properties->ID,
"value" => $feature->properties->ID,
"gmkName" => $feature->properties->NAME
);
}
header("Content-type:application/json; charset=utf-8");
echo json_encode($resultArray);
}
if($command == "getGmkName") {
$searchString = utf8_encode($_REQUEST['term']);
//$pattern = "/[a-z0-9]/i";
//if (!preg_match($pattern, $searchString)) {
// echo "Ungültiger Suchbegriff";
//die();
//}
$searchFeaturetype = $featuretypeGmkNr;
$filter = '
' . $gmkNameAttr . '
*' . $searchString . '*
';
$e = new mb_exception($filter);
$resultObj = getGeoJson($searchFeaturetype, $filter);
$resultArray = array();
foreach($resultObj->features as $feature) {
$resultArray[] = array (
"id" => $feature->properties->NAME,
"label" => $feature->properties->NAME,
"value" => $feature->properties->NAME,
"gmkNr" => $feature->properties->ID
);
}
header("Content-type:application/json; charset=utf-8");
echo json_encode($resultArray);
}
if($command == "getFluren") {
$gmkNr = $_REQUEST['gmkNr'];
$pattern = "/[0-9]/i";
if (!preg_match($pattern, $gmkNr)) {
echo "Ungültige Gemarkungsnr";
die();
}
$searchFeaturetype = $featuretypeFlur;
$filter = '
' . $gmkNrAttrFlur . '
' . $gmkNr . '
';
$resultObj = getGeoJson($searchFeaturetype, $filter);
$resultArray = array();
foreach($resultObj->features as $feature) {
$resultArray[] = $feature->properties->NAME;
}
header("Content-type:application/json; charset=utf-8");
sort($resultArray);
echo json_encode($resultArray);
}
if($command == "getFlz") {
$gmkNr = $_REQUEST['gmkNr'];
$flurNr = $_REQUEST['flurNr'];
$pattern = "/[0-9]/i";
if (!preg_match($pattern, $gmkNr)) {
echo "Ungültige Gemarkungsnr";
die();
}
if (!preg_match($pattern, $flurNr)) {
echo "Ungültige Flurnr";
die();
}
$searchFeaturetype = $featuretypeFlz;
$filter = '
' . $gmkNrAttrFlz . '
' . $gmkNr . '
' . $flurAttrFlz . '
' . $flurNr . '
';
$resultObj = getGeoJson($searchFeaturetype, $filter);
$resultArray = array();
foreach($resultObj->features as $feature) {
$resultArray[] = $feature->properties->ID;
}
header("Content-type:application/json; charset=utf-8");
$resultArray = array_unique($resultArray);
sort($resultArray);
echo json_encode($resultArray);
}
if($command == "getFln") {
$gmkNr = $_REQUEST['gmkNr'];
$flurNr = $_REQUEST['flurNr'];
$flz = $_REQUEST['flz'];
$pattern = "/[0-9]/i";
if (!preg_match($pattern, $gmkNr)) {
echo "Ungültige Gemarkungsnr";
die();
}
if (!preg_match($pattern, $flurNr)) {
echo "Ungültige Flurnr";
die();
}
if (!preg_match($pattern, $flz)) {
echo "Ungültiger Flz";
die();
}
$searchFeaturetype = $featuretypeFln;
$filter = '
' . $gmkNrAttrFlz . '
' . $gmkNr . '
' . $flurAttrFlz . '
' . $flurNr . '
' . $flzAttr . '
' . $flz . '
';
$resultObj = getGeoJson($searchFeaturetype, $filter);
#print_r($resultObj);
$resultArray = array();
foreach($resultObj->features as $feature) {
$resultArray[] = array("id" => $feature->properties->ID);
}
header("Content-type:application/json; charset=utf-8");
sort($resultArray);
echo json_encode($resultArray);
}
if($command == "getGeomForFlst") {
$gmkNr = $_REQUEST['gmkNr'];
$flurNr = $_REQUEST['flurNr'];
$flz = $_REQUEST['flz'];
$fln = $_REQUEST['fln'];
$srs = $_REQUEST['srs'];
$pattern = "/[0-9]/i";
if (!preg_match($pattern, $gmkNr)) {
echo "Ungültige Gemarkungsnr";
die();
}
if (!preg_match($pattern, $flurNr)) {
echo "Ungültige Flurnr";
die();
}
if (!preg_match($pattern, $flz)) {
echo "Ungültiger Flz";
die();
}
if($fln != "") {
$flnFilter = '
' . $flnAttr . '
' . $fln . '
';
}
$searchFeaturetype = $featuretypeFln;
$filter = '
' . $gmkNrAttrFlz . '
' . $gmkNr . '
' . $flurAttrFlz . '
' . $flurNr . '
' . $flzAttr . '
' . $flz . '
'.$flnFilter.'
';
$resultObj = getGeoJSON($searchFeaturetype, $filter,$srs);
header("Content-type:application/json; charset=utf-8");
echo json_encode($resultObj);
}
?>