/** * * * @param unknown $tag * @return unknown */ function dropNameSpace($tag) { //$tag = html_entity_decode($tag); $tag = gmlConverter::oneLineXML($tag); $tag = preg_replace('/ xmlns(?:.*?)?=\\".*?\\"/', "", $tag); // Remove xmlns with " $tag = preg_replace('/ xmlns(?:.*?)?=\'.*?\'/', "", $tag); // Remove xmlns with ' $tag = preg_replace('/ xsi(?:.*?)?=\\".*?\\"/', "", $tag); // remove xsi:schemaLocation with " $tag = preg_replace('/ xsi(?:.*?)?=\'.*?\'/', "", $tag); // remove xsi:schemaLocation with ' $tag = preg_replace('/ cs(?:.*?)?=\\".*?\\"/', "", $tag); // $tag = preg_replace('/ cs(?:.*?)?=\'.*?\'/', "", $tag); $tag = preg_replace('/ ts(?:.*?)?=\\".*?\\"/', "", $tag); $tag = preg_replace('/ decimal(?:.*?)?=\\".*?\\"/', "", $tag); $tag = preg_replace('/ decimal(?:.*?)?=\'.*?\'/', "", $tag); $tag = preg_replace("/[\\w-]*:(?![\\w-]*:)/", "", $tag); // remove any namespaces return $tag; }
function createSpatialFilterFromWKT($wkt, $function, $layerUrl, $srid = -1, $oneLine = true) { switch ($function) { case "intersects": $function = "ogc:Intersects"; break; case "overlaps": $function = "ogc:Overlaps"; break; case "within": $function = "ogc:Within"; break; case "touches": $function = "ogc:Touches"; break; } $__geofactory = new geometryfactory(); if ($srid != -1) { $srid = 'http://www.opengis.net/gml/srs/epsg.xml%23' . $srid; } $__geoObj = $__geofactory->createGeometry($wkt, $srid); $wfsFilter = ' <ogc:Filter xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"> <' . $function . '> <ogc:PropertyName>geometri</ogc:PropertyName> ' . $__geoObj->getGML() . ' </' . $function . '> </ogc:Filter> '; if ($oneLine) { $wfsFilter = gmlConverter::oneLineXML($wfsFilter); } return $wfsFilter; }