[Geoserver-users] RE: Adding the SLD body dynamically

Hi,

I want to add the SLD body of the map dynamically rather than statically
through the context.xml file. That is, I want to display not all, but only
some of the features, of a map layer depending on the input from the user.
Can anyone be kind enough to give advice on how this can be done in
GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the message
from your system; please do not copy or use it for any purpose, nor disclose
its contents to any other person. Thank you.]
---ST Electronics Group---

You should be able to do something like that using SLD-POST. There is some information on SLDs here: http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi,

I want to add the SLD body of the map dynamically rather than statically through the context.xml file. That is, I want to display not all, but only some of the features, of a map layer depending on the input from the user. Can anyone be kind enough to give advice on how this can be done in GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the message
from your system; please do not copy or use it for any purpose, nor disclose
its contents to any other person. Thank you.]
---ST Electronics Group---

Hi Brent,

Thank you for your reply. Pardon me, but the SLD-POST link under the URL you
have given to me does not contain any information. Could you please point
out to me where I can get relevant information to help in the implementation
of my desired feature as described? Thank you.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Friday, February 24, 2006 3:24 PM
To: Lee Wai See
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] RE: Adding the SLD body dynamically

You should be able to do something like that using SLD-POST. There is
some information on SLDs here:
http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi,

I want to add the SLD body of the map dynamically rather than
statically through the context.xml file. That is, I want to display
not all, but only some of the features, of a map layer depending on
the input from the user. Can anyone be kind enough to give advice on
how this can be done in GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the

message

from your system; please do not copy or use it for any purpose, nor

disclose

its contents to any other person. Thank you.]
---ST Electronics Group---

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

opps, it is empty.
There are some examples under the link: http://docs.codehaus.org/display/GEOSDOC/InLineFeature+Usage

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi Brent,

Thank you for your reply. Pardon me, but the SLD-POST link under the URL you
have given to me does not contain any information. Could you please point
out to me where I can get relevant information to help in the implementation
of my desired feature as described? Thank you.

Regards, Lee Wai See ST Electronics (Info-Software Systems) Pte Ltd

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Friday, February 24, 2006 3:24 PM
To: Lee Wai See
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] RE: Adding the SLD body dynamically

You should be able to do something like that using SLD-POST. There is some information on SLDs here: http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:
  

Hi,

I want to add the SLD body of the map dynamically rather than statically through the context.xml file. That is, I want to display not all, but only some of the features, of a map layer depending on the input from the user. Can anyone be kind enough to give advice on how this can be done in GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the
    

message
  

from your system; please do not copy or use it for any purpose, nor
    

disclose
  

its contents to any other person. Thank you.]
---ST Electronics Group---

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi Lee Wai See,

  I have recently been working with this as well. Alex Petkov has a
nice example: http://docs.codehaus.org/display/GEOSDOC/SLD+Snippets

Look at the bottom. If you take out the first named layer it will work
directly with the geoserver1.3.war demo/sampleRequest/ using the TestWfsPost

Also add the topp: prefix to states => topp:states

url:
http://localhost:8080/geoserver/wms/GetNap

body:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
  <StyledLayerDescriptor version="1.0.0">
   <NamedLayer>
    <Name>topp:states</Name>
     <NamedStyle>
      <Name>population</Name>
     </NamedStyle>
    </NamedLayer>
   </StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
    <gml:coord>
     <gml:X>-130.0</gml:X>
     <gml:Y>24.0</gml:Y>
    </gml:coord>
    <gml:coord>
     <gml:X>-66.0</gml:X>
     <gml:Y>50.0</gml:Y>
    </gml:coord>
   </BoundingBox>
   <Output><Format>image/png</Format>
    <Size>
     <Width>600</Width>
     <Height>320</Height>
    </Size>
   </Output>
   <Exceptions>application/vnd.ogc.se+xml</Exceptions>
  </ogc:GetMap>

I don't know the way mapbuilder works but here is a sample code for using
java to feed a custom sld to a wms/GetMap Post

Snippet:
try {
  URL u = new URL("http://www.web-demographics.com/geoserver/wms/GetMap&quot;\);
  HttpURLConnection geocon = (HttpURLConnection)u.openConnection();
  geocon.setAllowUserInteraction(false);
  geocon.setRequestMethod("POST");
  geocon.setRequestProperty("Content-Type", "application/xml");
  geocon.setDoOutput(true);
  geocon.setDoInput(true);
  geocon.setUseCaches(false);
  System.out.println("GetImage\n"+sld.toString());
  xmlOut = new PrintWriter(new BufferedWriter(new
           OutputStreamWriter(geocon.getOutputStream())));
  xmlOut.write(sld.toString());
  xmlOut.flush();
  xmlOut.close();
  response.setHeader("Cache-Control", "no-store, no-cache,
                      must-revalidate");
  response.addHeader("Cache-Control", "post-check=0, pre-check=0");
  response.setHeader("Pragma", "no-cache");
  response.setContentType("image/jpeg");
  OutputStream outsld = response.getOutputStream();
  int c;
  InputStream in = geocon.getInputStream();
  while ((c = in.read()) != -1) outsld.write(c);
  in.close();
  outsld.close();
            
} catch (IOException e) {
  e.printStackTrace();
} catch (Exception e) {
  System.out.println("WMSFeature: "+e.toString());
}

Here is another example sld for filtering by bounding box and parameter
value:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
  <StyledLayerDescriptor version="1.0.0">
<NamedLayer>
  <Name>geo:USGS_Quat_Faults</Name>
  <UserStyle>
  <Name>geothermalgeo:USGS_Quat_Faults</Name>
  <Title>Geothermal</Title>
  <Abstract>Geothermal filters</Abstract>
    <FeatureTypeStyle>
      <Rule>
             <!-- Theme 1 -->
              <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <ogc:PropertyIsBetween>
                  <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                  <ogc:LowerBoundary>
                    <ogc:Literal>0.001</ogc:Literal>
                  </ogc:LowerBoundary>
                  <ogc:UpperBoundary>
                    <ogc:Literal>17.5005</ogc:Literal>
                  </ogc:UpperBoundary>
                </ogc:PropertyIsBetween>
              </ogc:Filter>
        <LineSymbolizer>
          <Stroke>
            <CssParameter name="stroke">
              <ogc:Literal>#0000FF</ogc:Literal>
            </CssParameter>
            <CssParameter name="stroke-width">
              <ogc:Literal>2</ogc:Literal>
            </CssParameter>
          </Stroke>
        </LineSymbolizer>
      </Rule>
      <Rule>
             <!-- Theme 2 -->
              <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <ogc:PropertyIsBetween>
                  <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                  <ogc:LowerBoundary>
                    <ogc:Literal>17.5005</ogc:Literal>
                  </ogc:LowerBoundary>
                  <ogc:UpperBoundary>
                    <ogc:Literal>35</ogc:Literal>
                  </ogc:UpperBoundary>
                </ogc:PropertyIsBetween>
              </ogc:Filter>
        <LineSymbolizer>
          <Stroke>
            <CssParameter name="stroke">
              <ogc:Literal>#FF0000</ogc:Literal>
            </CssParameter>
            <CssParameter name="stroke-width">
              <ogc:Literal>2</ogc:Literal>
            </CssParameter>
          </Stroke>
        </LineSymbolizer>
      </Rule>
  </FeatureTypeStyle>
  </UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
    <gml:coord>
     <gml:X>-116.01796340942383</gml:X>
     <gml:Y>36.40119743347168</gml:Y>
    </gml:coord>
    <gml:coord>
     <gml:X>-114.8682632446289</gml:X>
     <gml:Y>37.33532905578613</gml:Y>
    </gml:coord>
   </BoundingBox>
   <Output><Format>image/jpeg</Format>
    <Size>
     <Width>1000</Width>
     <Height>813</Height>
    </Size>
   </Output>
   <Exceptions>application/vnd.ogc.se+xml</Exceptions>
  </ogc:GetMap>

Hope this helps
Rkgeorge

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Lee Wai
See
Sent: Friday, February 24, 2006 12:35 AM
To: 'Brent Owens'
Cc: geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] RE: Adding the SLD body dynamically

Hi Brent,

Thank you for your reply. Pardon me, but the SLD-POST link under the URL you
have given to me does not contain any information. Could you please point
out to me where I can get relevant information to help in the implementation
of my desired feature as described? Thank you.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Friday, February 24, 2006 3:24 PM
To: Lee Wai See
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] RE: Adding the SLD body dynamically

You should be able to do something like that using SLD-POST. There is
some information on SLDs here:
http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi,

I want to add the SLD body of the map dynamically rather than
statically through the context.xml file. That is, I want to display
not all, but only some of the features, of a map layer depending on
the input from the user. Can anyone be kind enough to give advice on
how this can be done in GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the

message

from your system; please do not copy or use it for any purpose, nor

disclose

its contents to any other person. Thank you.]
---ST Electronics Group---

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hey Randy, could you edit Alex's example to use topp:states? And put your other examples up on that page as well? You just need to sign up for a wiki account, see http://docs.codehaus.org/display/GEOSDOC/Guide+to+Documenting+GeoServer for more information and documenting advice. It would be great to post the code snipped on the wiki, and we made the SLD Snippets so a number of different users could all put up sample SLDs...

best regards,

Chris

Randy George wrote:

Hi Lee Wai See,

  I have recently been working with this as well. Alex Petkov has a
nice example: http://docs.codehaus.org/display/GEOSDOC/SLD+Snippets

Look at the bottom. If you take out the first named layer it will work
directly with the geoserver1.3.war demo/sampleRequest/ using the TestWfsPost

Also add the topp: prefix to states => topp:states

url:
http://localhost:8080/geoserver/wms/GetNap

body:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
  <StyledLayerDescriptor version="1.0.0">
   <NamedLayer>
    <Name>topp:states</Name>
     <NamedStyle>
      <Name>population</Name>
     </NamedStyle>
    </NamedLayer>
   </StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
    <gml:coord>
     <gml:X>-130.0</gml:X>
     <gml:Y>24.0</gml:Y>
    </gml:coord>
    <gml:coord>
     <gml:X>-66.0</gml:X>
     <gml:Y>50.0</gml:Y>
    </gml:coord>
   </BoundingBox>
   <Output><Format>image/png</Format>
    <Size>
     <Width>600</Width>
     <Height>320</Height>
    </Size>
   </Output>
   <Exceptions>application/vnd.ogc.se+xml</Exceptions>
  </ogc:GetMap>

I don't know the way mapbuilder works but here is a sample code for using
java to feed a custom sld to a wms/GetMap Post

Snippet:
try {
  URL u = new URL("http://www.web-demographics.com/geoserver/wms/GetMap&quot;\); HttpURLConnection geocon = (HttpURLConnection)u.openConnection(); geocon.setAllowUserInteraction(false); geocon.setRequestMethod("POST");
  geocon.setRequestProperty("Content-Type", "application/xml");
  geocon.setDoOutput(true); geocon.setDoInput(true); geocon.setUseCaches(false); System.out.println("GetImage\n"+sld.toString());
  xmlOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(geocon.getOutputStream()))); xmlOut.write(sld.toString()); xmlOut.flush(); xmlOut.close();
  response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
  response.addHeader("Cache-Control", "post-check=0, pre-check=0");
  response.setHeader("Pragma", "no-cache");
  response.setContentType("image/jpeg");
  OutputStream outsld = response.getOutputStream();
  int c; InputStream in = geocon.getInputStream(); while ((c = in.read()) != -1) outsld.write(c); in.close(); outsld.close();
            } catch (IOException e) {
  e.printStackTrace();
} catch (Exception e) { System.out.println("WMSFeature: "+e.toString()); }

Here is another example sld for filtering by bounding box and parameter
value:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
  <StyledLayerDescriptor version="1.0.0">
<NamedLayer>
  <Name>geo:USGS_Quat_Faults</Name>
  <UserStyle>
  <Name>geothermalgeo:USGS_Quat_Faults</Name>
  <Title>Geothermal</Title>
  <Abstract>Geothermal filters</Abstract>
    <FeatureTypeStyle>
      <Rule>
             <!-- Theme 1 -->
              <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <ogc:PropertyIsBetween>
                  <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                  <ogc:LowerBoundary>
                    <ogc:Literal>0.001</ogc:Literal>
                  </ogc:LowerBoundary>
                  <ogc:UpperBoundary>
                    <ogc:Literal>17.5005</ogc:Literal>
                  </ogc:UpperBoundary>
                </ogc:PropertyIsBetween>
              </ogc:Filter>
        <LineSymbolizer>
          <Stroke>
            <CssParameter name="stroke">
              <ogc:Literal>#0000FF</ogc:Literal>
            </CssParameter>
            <CssParameter name="stroke-width">
              <ogc:Literal>2</ogc:Literal>
            </CssParameter>
          </Stroke>
        </LineSymbolizer>
      </Rule>
      <Rule>
             <!-- Theme 2 -->
              <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <ogc:PropertyIsBetween>
                  <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                  <ogc:LowerBoundary>
                    <ogc:Literal>17.5005</ogc:Literal>
                  </ogc:LowerBoundary>
                  <ogc:UpperBoundary>
                    <ogc:Literal>35</ogc:Literal>
                  </ogc:UpperBoundary>
                </ogc:PropertyIsBetween>
              </ogc:Filter>
        <LineSymbolizer>
          <Stroke>
            <CssParameter name="stroke">
              <ogc:Literal>#FF0000</ogc:Literal>
            </CssParameter>
            <CssParameter name="stroke-width">
              <ogc:Literal>2</ogc:Literal>
            </CssParameter>
          </Stroke>
        </LineSymbolizer>
      </Rule>
  </FeatureTypeStyle>
  </UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
    <gml:coord>
     <gml:X>-116.01796340942383</gml:X>
     <gml:Y>36.40119743347168</gml:Y>
    </gml:coord>
    <gml:coord>
     <gml:X>-114.8682632446289</gml:X>
     <gml:Y>37.33532905578613</gml:Y>
    </gml:coord>
   </BoundingBox>
   <Output><Format>image/jpeg</Format>
    <Size>
     <Width>1000</Width>
     <Height>813</Height>
    </Size>
   </Output>
   <Exceptions>application/vnd.ogc.se+xml</Exceptions>
  </ogc:GetMap>

Hope this helps
Rkgeorge

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Lee Wai
See
Sent: Friday, February 24, 2006 12:35 AM
To: 'Brent Owens'
Cc: geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] RE: Adding the SLD body dynamically

Hi Brent,

Thank you for your reply. Pardon me, but the SLD-POST link under the URL you
have given to me does not contain any information. Could you please point
out to me where I can get relevant information to help in the implementation
of my desired feature as described? Thank you.

Regards, Lee Wai See ST Electronics (Info-Software Systems) Pte Ltd

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Friday, February 24, 2006 3:24 PM
To: Lee Wai See
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] RE: Adding the SLD body dynamically

You should be able to do something like that using SLD-POST. There is some information on SLDs here: http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi,

I want to add the SLD body of the map dynamically rather than statically through the context.xml file. That is, I want to display not all, but only some of the features, of a map layer depending on the input from the user. Can anyone be kind enough to give advice on how this can be done in GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the

message

from your system; please do not copy or use it for any purpose, nor

disclose

its contents to any other person. Thank you.]
---ST Electronics Group---

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Chris Holmes
The Open Planning Project
thoughts at: http://cholmes.wordpress.com

Hello Randy:

Thank you very much for the samples. Can you explain where sld was
declared below (in the java code)? Maybe I just missed it.

Also, please feel free to post any SLD examples (like the you posted
on the bottom) to the wiki page. I won't mind doing that myself,
except that you probably know best what that particular SLD will
accomplish. Also, it looks like it's making a picture, so (with a risk
of portraying myself as a pest) can I ask you to post it to the
Gallery? If you want, attach a static image to an email and I will
post it.

http://docs.codehaus.org/display/GEOSDOC/Gallery

Cheers,

Alex

Snippet:
try {
URL u = new URL("http://www.web-demographics.com/geoserver/wms/GetMap&quot;\);
HttpURLConnection geocon = (HttpURLConnection)u.openConnection();
geocon.setAllowUserInteraction(false);
geocon.setRequestMethod("POST");
geocon.setRequestProperty("Content-Type", "application/xml");
geocon.setDoOutput(true);
geocon.setDoInput(true);
geocon.setUseCaches(false);
System.out.println("GetImage\n"+sld.toString());
xmlOut = new PrintWriter(new BufferedWriter(new
          OutputStreamWriter(geocon.getOutputStream())));
xmlOut.write(sld.toString());
xmlOut.flush();
xmlOut.close();
response.setHeader("Cache-Control", "no-store, no-cache,
                     must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg");
OutputStream outsld = response.getOutputStream();
int c;
InputStream in = geocon.getInputStream();
while ((c = in.read()) != -1) outsld.write(c);
in.close();
outsld.close();

} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
System.out.println("WMSFeature: "+e.toString());
}

Here is another example sld for filtering by bounding box and parameter
value:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
<StyledLayerDescriptor version="1.0.0">
<NamedLayer>
<Name>geo:USGS_Quat_Faults</Name>
<UserStyle>
<Name>geothermalgeo:USGS_Quat_Faults</Name>
<Title>Geothermal</Title>
<Abstract>Geothermal filters</Abstract>
   <FeatureTypeStyle>
     <Rule>
            <!-- Theme 1 -->
             <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
               <ogc:PropertyIsBetween>
                 <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                 <ogc:LowerBoundary>
                   <ogc:Literal>0.001</ogc:Literal>
                 </ogc:LowerBoundary>
                 <ogc:UpperBoundary>
                   <ogc:Literal>17.5005</ogc:Literal>
                 </ogc:UpperBoundary>
               </ogc:PropertyIsBetween>
             </ogc:Filter>
       <LineSymbolizer>
         <Stroke>
           <CssParameter name="stroke">
             <ogc:Literal>#0000FF</ogc:Literal>
           </CssParameter>
           <CssParameter name="stroke-width">
             <ogc:Literal>2</ogc:Literal>
           </CssParameter>
         </Stroke>
       </LineSymbolizer>
     </Rule>
     <Rule>
            <!-- Theme 2 -->
             <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
               <ogc:PropertyIsBetween>
                 <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                 <ogc:LowerBoundary>
                   <ogc:Literal>17.5005</ogc:Literal>
                 </ogc:LowerBoundary>
                 <ogc:UpperBoundary>
                   <ogc:Literal>35</ogc:Literal>
                 </ogc:UpperBoundary>
               </ogc:PropertyIsBetween>
             </ogc:Filter>
       <LineSymbolizer>
         <Stroke>
           <CssParameter name="stroke">
             <ogc:Literal>#FF0000</ogc:Literal>
           </CssParameter>
           <CssParameter name="stroke-width">
             <ogc:Literal>2</ogc:Literal>
           </CssParameter>
         </Stroke>
       </LineSymbolizer>
     </Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
  <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
   <gml:coord>
    <gml:X>-116.01796340942383</gml:X>
    <gml:Y>36.40119743347168</gml:Y>
   </gml:coord>
   <gml:coord>
    <gml:X>-114.8682632446289</gml:X>
    <gml:Y>37.33532905578613</gml:Y>
   </gml:coord>
  </BoundingBox>
  <Output><Format>image/jpeg</Format>
   <Size>
    <Width>1000</Width>
    <Height>813</Height>
   </Size>
  </Output>
  <Exceptions>application/vnd.ogc.se+xml</Exceptions>
</ogc:GetMap>

Hope this helps
Rkgeorge

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Lee Wai
See
Sent: Friday, February 24, 2006 12:35 AM
To: 'Brent Owens'
Cc: geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] RE: Adding the SLD body dynamically

Hi Brent,

Thank you for your reply. Pardon me, but the SLD-POST link under the URL you
have given to me does not contain any information. Could you please point
out to me where I can get relevant information to help in the implementation
of my desired feature as described? Thank you.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Friday, February 24, 2006 3:24 PM
To: Lee Wai See
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] RE: Adding the SLD body dynamically

You should be able to do something like that using SLD-POST. There is
some information on SLDs here:
http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:
>
> Hi,
>
>
>
> I want to add the SLD body of the map dynamically rather than
> statically through the context.xml file. That is, I want to display
> not all, but only some of the features, of a map layer depending on
> the input from the user. Can anyone be kind enough to give advice on
> how this can be done in GeoServer ands MapBuilder?
>
>
>
> Hope I am clear in my question. Thanks.
>
>
>
> Regards,
> Lee Wai See
> ST Electronics (Info-Software Systems) Pte Ltd
>
>
>
> [This e-mail is confidential and may be priviledged. If you are not the
> intended recipient, please kindly notify us immediately and delete the
message
> from your system; please do not copy or use it for any purpose, nor
disclose
> its contents to any other person. Thank you.]
> ---ST Electronics Group---
>
>

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Aaahh you beat me to it Chris.

Alex

On 2/24/06, Chris Holmes <cholmes@...1...> wrote:

Hey Randy, could you edit Alex's example to use topp:states? And put
your other examples up on that page as well? You just need to sign up
for a wiki account, see
http://docs.codehaus.org/display/GEOSDOC/Guide+to+Documenting+GeoServer
for more information and documenting advice. It would be great to post
the code snipped on the wiki, and we made the SLD Snippets so a number
of different users could all put up sample SLDs...

best regards,

Chris

On 2/24/06, Chris Holmes <cholmes@...1...> wrote:

Hey Randy, could you edit Alex's example to use topp:states?

I just saw that the example in question is specific to the WCS branch,
so maybe the raster layer should be taken out.

Alex

Hi Randy George,

Thanks for the information given. They should be useful for me. However, I
still have some doubts, which I hope you can clear them for me:

1. With respect to the java code snippet to feed a custom SLD to a
wms/GetMap post, after getting back the response as an image file, how do
i display this image on my jsp page?

2. Again, with respect to the java code snippet, what is the sld declared?

Thank you.

Regards,
Lee Wai See

Hi Lee Wai See,

  I have recently been working with this as well. Alex Petkov has a
nice example: http://docs.codehaus.org/display/GEOSDOC/SLD+Snippets

Look at the bottom. If you take out the first named layer it will work
directly with the geoserver1.3.war demo/sampleRequest/ using the
TestWfsPost

Also add the topp: prefix to states => topp:states

url:
http://localhost:8080/geoserver/wms/GetNap

body:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
  <StyledLayerDescriptor version="1.0.0">
   <NamedLayer>
    <Name>topp:states</Name>
     <NamedStyle>
      <Name>population</Name>
     </NamedStyle>
    </NamedLayer>
   </StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
    <gml:coord>
     <gml:X>-130.0</gml:X>
     <gml:Y>24.0</gml:Y>
    </gml:coord>
    <gml:coord>
     <gml:X>-66.0</gml:X>
     <gml:Y>50.0</gml:Y>
    </gml:coord>
   </BoundingBox>
   <Output><Format>image/png</Format>
    <Size>
     <Width>600</Width>
     <Height>320</Height>
    </Size>
   </Output>
   <Exceptions>application/vnd.ogc.se+xml</Exceptions>
  </ogc:GetMap>

I don't know the way mapbuilder works but here is a sample code for using
java to feed a custom sld to a wms/GetMap Post

Snippet:
try {
  URL u = new URL("http://www.web-demographics.com/geoserver/wms/GetMap&quot;\);
  HttpURLConnection geocon = (HttpURLConnection)u.openConnection();
  geocon.setAllowUserInteraction(false);
  geocon.setRequestMethod("POST");
  geocon.setRequestProperty("Content-Type", "application/xml");
  geocon.setDoOutput(true);
  geocon.setDoInput(true);
  geocon.setUseCaches(false);
  System.out.println("GetImage\n"+sld.toString());
  xmlOut = new PrintWriter(new BufferedWriter(new
           OutputStreamWriter(geocon.getOutputStream())));
  xmlOut.write(sld.toString());
  xmlOut.flush();
  xmlOut.close();
  response.setHeader("Cache-Control", "no-store, no-cache,
                      must-revalidate");
  response.addHeader("Cache-Control", "post-check=0, pre-check=0");
  response.setHeader("Pragma", "no-cache");
  response.setContentType("image/jpeg");
  OutputStream outsld = response.getOutputStream();
  int c;
  InputStream in = geocon.getInputStream();
  while ((c = in.read()) != -1) outsld.write(c);
  in.close();
  outsld.close();

} catch (IOException e) {
  e.printStackTrace();
} catch (Exception e) {
  System.out.println("WMSFeature: "+e.toString());
}

Here is another example sld for filtering by bounding box and parameter
value:
<?xml version="1.0" encoding="UTF-8"?>
<ogc:GetMap
xmlns:ogc="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
version="1.1.1" service="WMS">
  <StyledLayerDescriptor version="1.0.0">
<NamedLayer>
  <Name>geo:USGS_Quat_Faults</Name>
  <UserStyle>
  <Name>geothermalgeo:USGS_Quat_Faults</Name>
  <Title>Geothermal</Title>
  <Abstract>Geothermal filters</Abstract>
    <FeatureTypeStyle>
      <Rule>
             <!-- Theme 1 -->
              <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <ogc:PropertyIsBetween>
                  <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                  <ogc:LowerBoundary>
                    <ogc:Literal>0.001</ogc:Literal>
                  </ogc:LowerBoundary>
                  <ogc:UpperBoundary>
                    <ogc:Literal>17.5005</ogc:Literal>
                  </ogc:UpperBoundary>
                </ogc:PropertyIsBetween>
              </ogc:Filter>
        <LineSymbolizer>
          <Stroke>
            <CssParameter name="stroke">
              <ogc:Literal>#0000FF</ogc:Literal>
            </CssParameter>
            <CssParameter name="stroke-width">
              <ogc:Literal>2</ogc:Literal>
            </CssParameter>
          </Stroke>
        </LineSymbolizer>
      </Rule>
      <Rule>
             <!-- Theme 2 -->
              <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
                <ogc:PropertyIsBetween>
                  <ogc:PropertyName>SLIPRATE</ogc:PropertyName>
                  <ogc:LowerBoundary>
                    <ogc:Literal>17.5005</ogc:Literal>
                  </ogc:LowerBoundary>
                  <ogc:UpperBoundary>
                    <ogc:Literal>35</ogc:Literal>
                  </ogc:UpperBoundary>
                </ogc:PropertyIsBetween>
              </ogc:Filter>
        <LineSymbolizer>
          <Stroke>
            <CssParameter name="stroke">
              <ogc:Literal>#FF0000</ogc:Literal>
            </CssParameter>
            <CssParameter name="stroke-width">
              <ogc:Literal>2</ogc:Literal>
            </CssParameter>
          </Stroke>
        </LineSymbolizer>
      </Rule>
  </FeatureTypeStyle>
  </UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
    <gml:coord>
     <gml:X>-116.01796340942383</gml:X>
     <gml:Y>36.40119743347168</gml:Y>
    </gml:coord>
    <gml:coord>
     <gml:X>-114.8682632446289</gml:X>
     <gml:Y>37.33532905578613</gml:Y>
    </gml:coord>
   </BoundingBox>
   <Output><Format>image/jpeg</Format>
    <Size>
     <Width>1000</Width>
     <Height>813</Height>
    </Size>
   </Output>
   <Exceptions>application/vnd.ogc.se+xml</Exceptions>
  </ogc:GetMap>

Hope this helps
Rkgeorge

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Lee Wai
See
Sent: Friday, February 24, 2006 12:35 AM
To: 'Brent Owens'
Cc: geoserver-users@lists.sourceforge.net
Subject: RE: [Geoserver-users] RE: Adding the SLD body dynamically

Hi Brent,

Thank you for your reply. Pardon me, but the SLD-POST link under the URL
you
have given to me does not contain any information. Could you please point
out to me where I can get relevant information to help in the
implementation
of my desired feature as described? Thank you.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

-----Original Message-----
From: geoserver-users-admin@lists.sourceforge.net
[mailto:geoserver-users-admin@lists.sourceforge.net] On Behalf Of Brent
Owens
Sent: Friday, February 24, 2006 3:24 PM
To: Lee Wai See
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] RE: Adding the SLD body dynamically

You should be able to do something like that using SLD-POST. There is
some information on SLDs here:
http://docs.codehaus.org/display/GEOSDOC/SLD%20Explanations%20and%20Samples
It is a good starting point.

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi,

I want to add the SLD body of the map dynamically rather than
statically through the context.xml file. That is, I want to display
not all, but only some of the features, of a map layer depending on
the input from the user. Can anyone be kind enough to give advice on
how this can be done in GeoServer ands MapBuilder?

Hope I am clear in my question. Thanks.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the

message

from your system; please do not copy or use it for any purpose, nor

disclose

its contents to any other person. Thank you.]
---ST Electronics Group---

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users