function toGeoJSON() { $rssDoc = new SimpleXMLElement($this->doc); $rssDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls'); $rssDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml'); $rssDoc->registerXPathNamespace('georss', 'http://www.georss.org/georss'); #for ingrid - portalu georss $rssDoc->registerXPathNamespace('ingrid', 'http://www.portalu.de/opensearch/extension/1.0'); // build feature collection $featureCollection = new FeatureCollection(); // elements of rss document $rssItems = $rssDoc->xpath("//item"); if (count($rssItems) > 0) { foreach ($rssItems as $item) { $rssItem_dom = dom_import_simplexml($item); $feature = new geoRSSItem(); $feature->targetEPSG = $this->targetEPSG; $feature->parse($rssItem_dom, $this->importItems); if (isset($feature->geometry) && $feature->geometry !== false) { $featureCollection->addFeature($feature); } } return $featureCollection->toGeoJSON(); } else { return "{'errorMessage':'Kein Ergebnis'}"; } }
function toGeoJSON() { $gmlDoc = new SimpleXMLElement($this->doc); $gmlDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls'); $gmlDoc->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs'); $gmlDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml'); // build feature collection $featureCollection = new FeatureCollection(); // segments of the featzreCollection $gmlFeatureMembers = $gmlDoc->xpath("//gml:featureMember"); if (count($gmlFeatureMembers) > 0) { $cnt = 0; foreach ($gmlFeatureMembers as $gmlFeatureMember) { $featureMember_dom = dom_import_simplexml($gmlFeatureMember); $feature = new Feature(); if ($this->geomFeaturetypeElement != null) { $feature->parse($featureMember_dom, $this->geomFeaturetypeElement); } else { $feature->parse($featureMember_dom); } if (isset($feature->geometry)) { $featureCollection->addFeature($feature); } $cnt++; } return $featureCollection->toGeoJSON(); } else { return "{}"; } }