Hello GeoServer List,

I am pretty excited because I just bumped into a few posts that said that it
is possible to change SLD through OpenLayers.  I never knew this was
possible and I have been creating an overhead of layers and sql views in my
server just to promote different features :p.  Well now I am trying to do
such a thing and it is not working for me, but I think I am close...

//My Layer (WMSLayer I wrote myself)
var tibet_1900_no_name = WMSLayer("Tibet 1900 - Kham Towns and Mountains",
'cite:tibet_1900_no_names', false, 0, 'Kham');

function WMSLayer(text, layers, visible, minScale, layerId){
    var layer = new OpenLayers.Layer.WMS(text, "
http://localhost:8080/geoserver/wms";,
                {layers: layers, transparent: true},
                {layerId: layerId, isBaseLayer: false,
displayInLayerSwitcher: true, visibility: visible, minScale: minScale}
     );
                   return layer;
}//end WMSLayer

The layer works as expected..but then I do this when an option in a menu is
clicked,
tibet_1900_no_name.mergeNewParams({SLD :'
http://localhost:8080/geoserver/wms/tibet_1900.xml'});

and I get the following message "SLD document contains no layers" on a blank
white layer.

This is my SLD:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld";
xmlns:ogc="http://www.opengis.net/ogc";
  xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>
  <NamedLayer>
    <Name>cite:tibet_1900_no_names</Name>
    <UserStyle>
      <Title>Default point</Title>


      <FeatureTypeStyle>
        <!--<FeatureTypeName>Feature</FeatureTypeName>-->
        <Rule>
          <PointSymbolizer>
            <Graphic>

            <Mark>
                <WellKnownName>Square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#73EAF7</CssParameter>
                </Fill>
                <Stroke>
                       <CssParameter name="stroke">#39B331</CssParameter>
                       <CssParameter name="stroke-width">2</CssParameter>
                </Stroke>
              </Mark>

             <Size>6</Size>

            </Graphic>
          </PointSymbolizer>

          <TextSymbolizer>
          <label><ogc:PropertyName>name_rom</ogc:PropertyName>
          </label>


    <Font>
       <!-- <CssParameter name="font-family">SimSun</CssParameter>-->
        <CssParameter name="font-family">Unifont Medium</CssParameter>
        <CssParameter name="font-style">Normal</CssParameter>
        <CssParameter name="font-size">11</CssParameter>
       <!-- <CssParameter name="font-weight">bold</CssParameter>-->
    </Font>

    <Fill>
        <CssParameter name="fill">#000000</CssParameter>
    </Fill>

     <!--  make the label easy to read-->
            <Halo>
              <Radius>
             <ogc:Literal>2</ogc:Literal>
              </Radius>
              <Fill>
            <CssParameter name="fill">#FFFFFF</CssParameter>
            <CssParameter name="fill-opacity">0.85</CssParameter>

              </Fill>
            </Halo>

</TextSymbolizer>

        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

If anyone can tell me what I am doing wrong I'd really appreciate it :)

Thanks,
elshae
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to