[Mapbender-users] problem with sld editor and geoserver
Michael Schulz
mschulz at webgis.de
Wed Nov 10 11:32:07 EST 2010
Hi Christoph,
not sure, this is really just to show that the SLD-Editor is able to
open the Geoserver SLD, but at the moment these small workarounds
won't bring you to actually use the SLD. When the SLD is read it is
saved "as is" in the DB, so basically what should happen, when you
open the Editor is that you see two similar maps, because the one that
uses SLD-URL simply will feed Geoserver its own SLD. But when you
start editing the SLD, the internal sld-object is "encoded" as XML and
since we don't treat the new tags they won't make it in this SLD-XML
and presumably Geoserver will either just not use the SLD or it won't
draw the layer ...
Cheers, Michael
2010/11/10 Christoph Baudson <christoph.baudson at wheregroup.com>:
> Thanks for your work Michael :-) Is it something we could use in trunk?
>
> Christoph
>
>
> Michael Schulz wrote:
>>
>> Hi Karim and Zorg,
>>
>> ok, I could narrow down the problem a little and did some workarounds
>> to see whether it would work at all:
>>
>> - after eliminating the namespace problem (use xml_parser_create_ns)
>> it did turn out that Geoserver unlike Mapserver uses <ogc:literal>
>> element e.g. for the Value of <size>. So far the Literal tag was only
>> handled in the filter parser... And Geoserver uses the <isdefault> tag
>> which wasn't treated either.
>>
>> This small patch should at least get the SLD-Editor to parse the SLD
>> and display most of its contents, but the value e.g. of a <size> tag
>> is not evaluated since it sits inside a literal. Thus changing the SLD
>> and using the changed SLD with Geoserver will likely not work.
>> Therefore the new or rather unhandled tags have to be taken into
>> account and the object modell has to be adapted accordingly.
>>
>> Cheers, Michael
>>
>> Here is the patch-diff:
>>
>> +++ sld_parse.php (Arbeitskopie)
>> @@ -90,7 +90,7 @@
>> */
>> function parseSld($data)
>> {
>> - $xml_parser = xml_parser_create();
>> + $xml_parser = xml_parser_create_ns();
>> xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
>> xml_parse_into_struct($xml_parser, $data, $vals, $index);
>> xml_parser_free($xml_parser);
>> @@ -99,11 +99,12 @@
>> $parent = array();
>> $objects = array();
>> $parentactual = 0;
>> -
>> +
>> for ($i=0; $i<count($vals); $i++)
>> {
>> $element = $vals[$i];
>> - $tag = $element["tag"];
>> + $tagAr = explode(":",$element["tag"]);
>> + $tag = count($tagAr)>1?$tagAr[2]:$tagAr[0];
>> $tagname=strtoupper($tag);
>> switch($tagname)
>> {
>> @@ -859,6 +860,10 @@
>> //END TODO
>> //von den vorhergegangenen XML Elementen
>>
>> + // we have some new tags... as a workaround skip
>> them
>> + case "LITERAL":
>> + case "ISDEFAULT":
>> + break;
>>
>> default:
>> $temp = "";
>> --------- end of patch
>>
>>
>> 2010/11/10 Michael Schulz <mschulz at webgis.de>:
>>
>>>
>>> Hi Karim,
>>>
>>> the sld parser, was done the same way the older versions of the wms
>>> parsing were. The first and presumably not too complicated issue to
>>> overcome is namespace support. The next issue is the supported sld
>>> features problem. Since it was originally done for mapserver, it
>>> covers basically mapserver sld functionality and only geoserver sld
>>> where it overlaps. Although we're talking OGC standards (in my
>>> experience) the SLD implementation varies from WMS to WMS in some
>>> points, which can make parsing an sld pretty complicated (e.g. see an
>>> example for that on the discussion page of the SLD integration
>>> http://www.mapbender.org/Talk:Sld_integration)
>>>
>>> I currently checking whether the namespace issue is easy to fix and
>>> will come back with an answer later ...
>>>
>>> Cheers, Michael
>>>
>>> 2010/11/10 Karim Malhas <karim at malhas.de>:
>>>
>>>>
>>>> Hello Michael,
>>>>
>>>>
>>>>>
>>>>> ok, I could reproduce this behaviour with MB 2.7 also. This is a
>>>>> problem of the SLD parser (it has nothing to do with the wfs_conf
>>>>> assignment to a wms layer). The SLD-Editor has been initially
>>>>> developed and tested for Mapserver. I have done some things to be able
>>>>> to handle also GeoServer, but that was for GS 1.6/1.7 and especially
>>>>> prior to GS supporting the getStyles request.
>>>>>
>>>>> I think from GS 2 onwards the getStyles request is supported but the
>>>>> SLD parser is currently not able to cope with it. This would mean it
>>>>> will need to be overhauled for this requirement. Unfortunately I don't
>>>>> have enough ressources at the moment to do this.
>>>>>
>>>>
>>>> Do you have a specific example of where the parsing fails ? No time to
>>>> fix here, just curious.
>>>>
>>>> Regards,
>>>> Karim
>>>>
>>>> _______________________________________________
>>>> Mapbender_users mailing list
>>>> Mapbender_users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>>>
>>>>
>>>
>>> --
>>> -----------------------------------------------------------
>>> Michael Schulz
>>> mschulz at webgis.de
>>>
>>> in medias res
>>> Gesellschaft für Informationstechnologie mbH
>>>
>>> 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
>>>
>>> http://www.webgis.de / http://www.zopecms.de
>>> --------------------------------------------------------------
>>> Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
>>> Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg
>>>
>>>
>>
>>
>>
>>
>
>
> --
>
> ********************************************
> Where2B Konferenz 2010
> 09. Dezember 2010 in Bonn
> www.where2b-conference.com
> ********************************************
> ----------------------------------
>
> Aufwind durch Wissen!
>
> Qualifizierte OpenSource-Schulungen
> bei der www.foss-academy.eu
>
> ----------------------------------
> _______________________________________
>
> W h e r e G r o u p GmbH & Co. KG
>
> Siemensstraße 8
> 53121 Bonn
> Germany
>
> Christoph Baudson
> Anwendungsentwickler
>
> Fon: +49 (0)228 / 90 90 38 - 15
> Fax: +49 (0)228 / 90 90 38 - 11
> christoph.baudson at wheregroup.com
> www.wheregroup.com
> Amtsgericht Bonn, HRA 6788
> _______________________________________
>
> Komplementärin:
> WhereGroup Verwaltungs GmbH
> vertreten durch:
> Olaf Knopp, Peter Stamm
> _______________________________________
> _______________________________________________
> Mapbender_users mailing list
> Mapbender_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>
--
-----------------------------------------------------------
Michael Schulz
mschulz at webgis.de
in medias res
Gesellschaft für Informationstechnologie mbH
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
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_users
mailing list