[Mapbender-dev] Re: wfs gazetteer with umn mapserver wfs

Michael Schulz mschulz at webgis.de
Tue Jul 28 11:13:29 EDT 2009


Hi Michael,  ;-)

another approach would be to search with xpath for
"gml:featureMember", and then feed the firstChild, which is always the
featuretype to the featuretype parser ... sth. like that:

$gmlFeatureMembers = $gmlDoc->xpath("//gml:featureMember");
if (count($gmlFeatureMembers) > 0) {
	foreach ($gmlFeatureMembers as $gmlFeatureMember) {
		$gmlfeatureMember_dom = dom_import_simplexml($gmlFeatureMember);
		$feature = new Feature();
		$this->parseFeature($gmlfeatureMember_dom->firstChild, $feature, $wfsConf);
		if (isset($feature->geometry)) {
			$gml->featureCollection->addFeature($feature);
		}
	}
}

Actually, I wondered why e.g. QGIS had no problems to load a UMN
WFS... so that's the reason.

Cheers, mandsch


2009/7/28 Michael Schulz <mschulz at webgis.de>:
> Hi Devs,
>
> after some detours and especially after some valuable hints from
> Christoph on irc I came to this workaround, for the described problem,
> when using UMN as WFS-Server and getting no results from WFS-Gazatteer
> requests, because there is an obscure namespace problem with UMN-WFS
> (it breaks down to: umn gives a featuretype name in the getcaps
> without ns, this is stored in the mapbender db, when parsing
> getfeature request, that stored value is used to go through the
> getfeature result xml, that unfortunately now uses a namespace "ms:",
> so mapbender code won't find any features).
>
> My workaround is to ignore namespaces when searching for the result
> features, by using the xpath function local-name(). This can be
> applied in class_gml_factory around line 20, instead of:
>
>  $gmlFeatureMembers = $gmlDoc->xpath("//" . $featureType->name);
>
> you could write:
>
>  $admin = new administration();
>  $gmlFeatureMembers = $gmlDoc->xpath("//*[local-name()='".
> $admin->sepNameSpace($featureType->name)."']" );
>
> This ignores the namespace, but certainly leaves the xml untouched.
> I've tested it with UMN and Geoserver. If someone wants to give it a
> try, I'll be happy for any feedback.
>
> Cheers, Michael
>
>
> 2009/7/14 Michael Schulz <mschulz at webgis.de>:
>> Hi,
>>
>> I have a strange problem when using umn mapserver as a wfs-server for
>> a gazetteer search. The problem is that the featuretype is announced
>> in get getCaps as
>>
>> <Name>meinFeatureType</Name>.
>>
>>  When actually searching and issueing the getfeature request, the
>> result is returned with featuremembers with the default ms namespace:
>>
>> <gml:featureMember><ms:meinFeatureType
>> fid="meinFeatureType.007">...</gml:featureMember>.
>>
>> The problem is now that in the gml classes, the returned gml is
>> accessed with the xpath function searching for the featuretype name as
>> recieved from the getCapabilities response and since this name has no
>> namespace it won't find the featuremembers...
>>
>> Is this a mapserver wfs misconfiguration on my side (i tried with
>> wms_namespace_prefix ...) or a mapserver wfs bug or a mapbender bug?
>> When using geoserver the featuretype namespace is also returned in the
>> getcapabilities response.
>>
>> Thanks for your hints ... Michael
>>
>> --
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Aufwind durch Wissen!
>>
>> Qualifizierte Open Source Schulungen bei der
>> http://www.foss-akademie.de/
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> -----------------------------------------------------------
>> Michael Schulz
>> mschulz at webgis.de
>>
>> in medias res
>> Gesellschaft für Informationstechnologie mbH
>>
>> +++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++
>>
>> Schwimmbadstraße 2
>> D-79100  Freiburg i. Br.
>>
>> Tel:  +49 (0)761 705798-102
>> Tel:  +49 (0)761 705798-0
>> Fax: +49 (0)761 705798-09
>>
>> +++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++
>>
>> http://www.webgis.de / http://www.zopecms.de
>> --------------------------------------------------------------
>> Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
>> Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg
>>
>
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Aufwind durch Wissen!
>
> Qualifizierte Open Source Schulungen bei der
> http://www.foss-akademie.de/
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> -----------------------------------------------------------
> Michael Schulz
> mschulz at webgis.de
>
> in medias res
> Gesellschaft für Informationstechnologie mbH
>
> +++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++
>
> Schwimmbadstraße 2
> D-79100  Freiburg i. Br.
>
> Tel:  +49 (0)761 705798-102
> Tel:  +49 (0)761 705798-0
> Fax: +49 (0)761 705798-09
>
> +++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++
>
> http://www.webgis.de / http://www.zopecms.de
> --------------------------------------------------------------
> Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
> Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg
>



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aufwind durch Wissen!

Qualifizierte Open Source Schulungen bei der
http://www.foss-akademie.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----------------------------------------------------------
Michael Schulz
mschulz at webgis.de

in medias res
Gesellschaft für Informationstechnologie mbH

+++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++

Schwimmbadstraße 2
D-79100  Freiburg i. Br.

Tel:  +49 (0)761 705798-102
Tel:  +49 (0)761 705798-0
Fax: +49 (0)761 705798-09

+++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++

http://www.webgis.de / http://www.zopecms.de
--------------------------------------------------------------
Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg


More information about the Mapbender_dev mailing list