<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GeoServer Blog &#187; Tips and Tricks</title>
	<atom:link href="http://blog.geoserver.org/category/tips-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.geoserver.org</link>
	<description>Everything GeoServer, and a little more</description>
	<lastBuildDate>Wed, 21 Dec 2011 22:28:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Polymorphism in application-schema</title>
		<link>http://blog.geoserver.org/2010/05/25/polymorphism-in-application-schema/</link>
		<comments>http://blog.geoserver.org/2010/05/25/polymorphism-in-application-schema/#comments</comments>
		<pubDate>Tue, 25 May 2010 08:30:20 +0000</pubDate>
		<dc:creator>rangreani</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=660</guid>
		<description><![CDATA[Support for polymorphism is included in Geoserver 2.0.2. Why do we need polymorphism support in app-schema? Some complex attributes are polymorphic by nature, which means they can have different types for different features. Before polymorphism was supported, attribute types had to be specified in the mapping file, so could not vary across features. With polymorphism support, [...]]]></description>
			<content:encoded><![CDATA[<p>Support for  polymorphism is included in Geoserver  2.0.2. Why do we need  polymorphism support in  app-schema? Some complex  attributes are  polymorphic by nature,  which means they can have different types for   different features.</p>
<div>
<p>Before polymorphism was supported, attribute types had to be specified in the  mapping file, so could not vary across features. With polymorphism support, filter functions can now be used to specify conditions when  determining the encoded type.</p>
<p><span><span lang="EN-AU"><span style="text-decoration: underline">For example: </span></span></span></p>
<p>If MaterialCode is  &#8220;rock&#8221;, er:material should be encoded as gsml:RockMaterial, otherwise it should  be encoded as  gsml:Mineral.</p>
<p>This can be expressed  in the mapping file like this:</p>
<pre>&lt;AttributeMapping&gt;
    &lt;targetAttribute&gt;er:material&lt;/targetAttribute&gt;
    &lt;sourceExpression&gt;
        &lt;linkElement&gt;
            if_then_else(equalTo(MaterialCode, 'rock'), 'gsml:RockMaterial', 'gsml:Mineral')
        &lt;/linkElement&gt;
    &lt;/sourceExpression&gt;
&lt;/AttributeMapping&gt;</pre>
</div>
<p>Another common example is  replacing null values with an xlink:href  to a URI representing missing  values:</p>
<pre>&lt;AttributeMapping&gt;
    &lt;targetAttribute&gt;er:startDate&lt;/targetAttribute&gt;
    &lt;sourceExpression&gt;
        &lt;linkElement&gt;if_then_else(isNull(START_DATE), toXlinkHref('urn:ogc:def:nil:OGC::missing'),
                         'gml:TimeInstantPropertyType')
        &lt;/linkElement&gt;
    &lt;/sourceExpression&gt;
&lt;/AttributeMapping&gt;</pre>
<p>Read more about  app-schema polymorphism support: <a href="http://docs.geoserver.org/stable/en/user/data/app-schema/polymorphism.html">polymorphism</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2010/05/25/polymorphism-in-application-schema/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SLD Cookbook</title>
		<link>http://blog.geoserver.org/2010/04/09/sld-cookbook/</link>
		<comments>http://blog.geoserver.org/2010/04/09/sld-cookbook/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 14:49:18 +0000</pubDate>
		<dc:creator>Mike Pumphrey</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[cookbook]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[SLD]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[styling]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=576</guid>
		<description><![CDATA[Styling map layers in GeoServer can be challenging. While there are some ways to craft map layers without ever needing to look at Styled Layer Descriptor (SLD) code, there are some who don&#8217;t want an intermediary and want to code with SLD directly. For those, there are few options: 1. Read the OGC SLD 1.0 [...]]]></description>
			<content:encoded><![CDATA[<p>Styling map layers in GeoServer can be challenging.  While there are <a href="http://blog.geoserver.org/2010/04/05/styling-geoserver-layers-with-css/" target="_blank">some</a> <a href="http://blog.opengeo.org/2009/05/05/styler/" target="_blank">ways</a> to craft map layers without ever needing to look at Styled Layer Descriptor (SLD) code, there are some who don&#8217;t want an intermediary and want to code with SLD directly.  For those, there are few options:</p>
<p>1. Read the <a href="http://www.opengeospatial.org/standards/sld" target="_blank">OGC SLD 1.0 specification</a>.  At 100+ pages, it can be a bit dense.<br />
2. Read the <a href="http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" target="_blank">SLD schema</a>.  Because, really, who doesn&#8217;t love interpreting schemas?</p>
<p>Failing those, the would-be map stylist is usually out of luck, needing to eke out an understanding of styling by asking on <a href="https://lists.sourceforge.net/lists/listinfo/geoserver-users" target="_blank">mailing lists</a> and doing web searches.</p>
<p>When I was learning SLD, I wanted simple examples that I could understand and edit.  I wanted screenshots.  I wanted to know which line of code did what.  I wanted to look up styles as if they were in a recipe book.  But this type of reference didn&#8217;t exist at the time.</p>
<p>The <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/index.html" target="_blank">SLD Cookbook</a> is that reference.  It is a &#8220;practical reference&#8221; to show how map styling works.  It is not designed to be exhaustive, and it won&#8217;t tell you about every possible edge case.  But it also has no SLDs that are hundreds of lines long, a strong hurdle to comprehension.</p>
<p>Want to know how to style a simple point?  <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/points.html#simple-point" target="_blank">Look at the example</a>, <a href="http://docs.geoserver.org/stable/en/user/_downloads/point_simplepoint.sld" target="_blank">download the SLD</a> (and the <a href="http://docs.geoserver.org/stable/en/user/_downloads/sld_cookbook_point.zip" target="_blank">shapefile</a> that generated the screenshot too, if you&#8217;d like), and <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/points.html#details" target="_blank">read the details</a>.  See which line of code accomplishes what, so if you want to make the points blue instead of red, you&#8217;ll know what line to change (line 8 in this case).  Want to see how to make a style where lines are styled differently by <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/lines.html#attribute-based-line" target="_blank">data attributes</a>? Or by <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/lines.html#zoom-based-line" target="_blank">zoom level</a>?  Refer as necessary.  Even those experienced with SLD may find the examples useful.</p>
<p>There are a few examples mixed in that leverage extensions to GeoServer/GeoTools (<a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/polygons.html#hatching-fill" target="_blank">polygon fill hatching</a>, <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/lines.html#label-following-line" target="_blank">labels that follow lines</a>) but for the most part, the examples are perfectly valid according to the SLD 1.0 specification.</p>
<p>I&#8217;m sure that more examples can and will be added in time.  I&#8217;ve already received some very good feedback from others, and some styles will likely be optimized.  But every example, every screenshot, and every SLD was tested in the <a href="http://geoserver.org/display/GEOS/Stable" target="_blank">most recent version of GeoServer</a>.</p>
<p>So <a href="http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/index.html" target="_blank">take a look</a>, and get styling!  I hope you enjoy.  Special thanks goes out to <a href="http://www.geonovum.nl/" target="_blank">Geonovum</a>, who funded this project.  I personally appreciate it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2010/04/09/sld-cookbook/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Extending your map styling with geometry transformations</title>
		<link>http://blog.geoserver.org/2010/03/17/extending-your-map-styling-with-geometry-transformations/</link>
		<comments>http://blog.geoserver.org/2010/03/17/extending-your-map-styling-with-geometry-transformations/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 18:55:33 +0000</pubDate>
		<dc:creator>Andrea Aime</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[SLD]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[styling]]></category>
		<category><![CDATA[transformation]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=505</guid>
		<description><![CDATA[When designing a map, sometimes you want to render something that is related to the geometries you have at hand, but which is not specifically the geometries themselves. Maybe you want to highlight the end of a line, create a drop shadow effect, or make the vertices that make up a geometry more evident to [...]]]></description>
			<content:encoded><![CDATA[<p>When designing a map, sometimes you want to render something that is related to the geometries you have at hand, but which is not specifically the geometries themselves. Maybe you want to highlight the end of a line, create a drop shadow effect, or make the vertices that make up a geometry more evident to the user.  Unfortunately the <a href="http://www.opengeospatial.org/standards/sld" target="_blank">SLD specification</a> that GeoServer uses for its rendering does not allow you to dynamically extract such information.  If you need to achieve those effects, you will usually need to generate a new layer by preprocessing your data offline (for example, using <a href="http://postgis.org/" target="_blank">PostGIS&#8217;s</a> excellent spatial analysis functions).</p>
<p>Today I&#8217;m going to show you how to achieve those effects dynamically using what we call <strong>geometry transformations</strong>. Geometry transformations are yet another extension to SLD in order to make it more powerful.  (Another example of SLD an extension that GeoServer has implemented is <a href="http://blog.geoserver.org/2008/12/08/dynamic-symbolizers-part-1/" target="_blank">dynamic</a> <a href="http://blog.geoserver.org/2008/12/16/dynamic-symbolizers-part-2/" target="_blank">symbolizers</a>.)  Standard SLD allows the user to specify a <code>&lt;Geometry&gt;</code> element in each symbolizer, but its contents can only be a <code>&lt;PropertyName&gt;</code>; this allows a user to choose a different geometry should a spatial table contain more than one.  With geometry transformations, GeoServer allows you to specify a filter function as well, which can transform the geometry.  (You may want to refer to my previous post on <a href="http://blog.geoserver.org/2010/02/08/geoserver-hidden-treasures-filter-functions/" target="_blank">filter functions</a>.)</p>
<p>Let&#8217;s look at an example. Say we have a building layer, rendered with a plain gray fill:</p>
<p style="text-align: center;"><img class="size-full wp-image-537 aligncenter" title="plain" src="http://blog.geoserver.org/wp-content/uploads/plain.png" alt="plain" width="512" height="434" /></p>
<p>We can add a twist to this plain map by adding a drop shadow beneath the buildings layer. To achieve this we will offset the buildings a bit, fill them dark gray, and then paint the standard buildings layer on top of it. The style looks like:</p>
<pre>
<pre>      &lt;FeatureTypeStyle&gt;
        &lt;Rule&gt;
          &lt;Title&gt;Shadow&lt;/Title&gt;
          &lt;PolygonSymbolizer&gt;
            &lt;Geometry&gt;
               &lt;ogc:Function name="offset"&gt;
                  &lt;ogc:PropertyName&gt;the_geom&lt;/ogc:PropertyName&gt;
                  &lt;ogc:Literal&gt;0.00004&lt;/ogc:Literal&gt;
                  &lt;ogc:Literal&gt;-0.00004&lt;/ogc:Literal&gt;
               &lt;/ogc:Function&gt;
            &lt;/Geometry&gt;
            &lt;Fill&gt;
              &lt;CssParameter name="fill"&gt;#555555&lt;/CssParameter&gt;
            &lt;/Fill&gt;
          &lt;/PolygonSymbolizer&gt;
        &lt;/Rule&gt;
      &lt;/FeatureTypeStyle&gt;
      &lt;FeatureTypeStyle&gt;
        &lt;Rule&gt;
          &lt;Title&gt;Polygon&lt;/Title&gt;
          &lt;PolygonSymbolizer&gt;
            &lt;Fill&gt;
              &lt;CssParameter name="fill"&gt;#CCCCCC&lt;/CssParameter&gt;
            &lt;/Fill&gt;
            &lt;Stroke&gt;
              &lt;CssParameter name="stroke"&gt;#000000&lt;/CssParameter&gt;
              &lt;CssParameter name="stroke-width"&gt;0.5&lt;/CssParameter&gt;
            &lt;/Stroke&gt;
          &lt;/PolygonSymbolizer&gt;
        &lt;/Rule&gt;
      &lt;/FeatureTypeStyle&gt;</pre>
</pre>
<p>And the result is:</p>
<p style="text-align: center;"><img class="size-full wp-image-538 aligncenter" title="shadow" src="http://blog.geoserver.org/wp-content/uploads/shadow1.png" alt="shadow" width="512" height="434" /></p>
<p>The filter function takes the geometries and offsets them by (0.00004, -0.00004).  Geometry transformations occur against the original geometry, which in this particular case is in EPSG:4326, so the values of the offset are also in units of lon/lat.</p>
<p>You can find more examples about this functionality in the <a href="http://docs.geoserver.org/stable/en/user/styling/sld-extensions/geometry-transformations.html" target="_blank">geometry transformations</a> section of the <a href="http://docs.geoserver.org/stable/en/user/" target="_blank">User Manual</a>.  You can also get creative by looking at the currently available set of <a href="http://docs.geoserver.org/stable/en/user/filter/function_reference.html" target="_blank">filter functions</a>. Also remember, if you want a function that&#8217;s not there, it is possible to add new ones; drop by on the <a href="https://lists.sourceforge.net/lists/listinfo/geoserver-devel" target="_blank">developer mailing list</a> and we&#8217;ll provide you with directions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2010/03/17/extending-your-map-styling-with-geometry-transformations/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GeoServer hidden treasures: filter functions</title>
		<link>http://blog.geoserver.org/2010/02/08/geoserver-hidden-treasures-filter-functions/</link>
		<comments>http://blog.geoserver.org/2010/02/08/geoserver-hidden-treasures-filter-functions/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 16:11:42 +0000</pubDate>
		<dc:creator>Andrea Aime</dc:creator>
				<category><![CDATA[Behind The Scenes]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=470</guid>
		<description><![CDATA[Ever had the need to format some text in SLD, or to perform complex filter in WFS, and noticed that the basic elements of the OGC Filter specification left you wanting for more? If so, welcome to the club. One thing few people know is that both SLD and WFS filtering capabilities can be extended [...]]]></description>
			<content:encoded><![CDATA[<p>Ever had the need to format some text in SLD, or to perform complex filter in WFS, and noticed that the basic elements of the OGC Filter specification left you wanting for more?</p>
<p>If so, welcome to the club. One thing few people know is that both SLD and WFS filtering capabilities can be extended by using <strong>filter functions</strong>. A filter function is just like a programming language function, it&#8217;s something that takes arguments and returns some result. For example, &#8220;sin(toRadians(45))&#8221; will compute the mathematical sin of 45 degrees, and &#8220;strSubstring(&#8220;hippopotamus&#8221;, 0,  5)&#8221; will return &#8220;hippo&#8221;.</p>
<p>The concept of filter function is standardized, but functions themselves are not, so once you start using them you&#8217;re tied to a specific server. However they often provide the level of flexibility that you just need in order to get some work done. The good news is that GeoServer already contains tens of them, from number and date formatting, to geometry manipulation, math, string wrangling. So far we just never found the time to document them, but things have changed and we have now quite a <a href="http://docs.geoserver.org/2.0.x/en/user/filter/index.html">complete reference along with some examples</a>.</p>
<p>Let me show you a simple example of using functions. Say we have a contour map, each isoline has an elevation, and we want to show it on the map. Unfortunately the elevation is stored as a floating point, resulting in a less than pleasing output of &#8220;150.0&#8243; or sometimes &#8220;149.999999&#8243; when we know the elevation accuracy does not go beyond the meter. To get nice labelling we can use the &#8220;numberFormat&#8221; filter function to force an integer representation instead (along with some VendorOptions):</p>
<pre>&lt;TextSymbolizer&gt;
  &lt;Label&gt;
    &lt;ogc:Function name="numberFormat"&gt;
       &lt;ogc:Literal&gt;#&lt;/ogc:Literal&gt;
       &lt;ogc:PropertyName&gt;ELEVATION&lt;/ogc:PropertyName&gt;
    &lt;/ogc:Function&gt;
   &lt;/Label&gt;</pre>
<pre>  ....</pre>
<pre>   &lt;VendorOption name="followLine"&gt;true&lt;/VendorOption&gt;
   &lt;VendorOption name="repeat"&gt;250&lt;/VendorOption&gt;
   &lt;VendorOption name="maxDisplacement"&gt;150&lt;/VendorOption&gt;
   &lt;VendorOption name="maxAngleDelta"&gt;30&lt;/VendorOption&gt;
&lt;/TextSymbolizer&gt;</pre>
<p>Notice how the the ELEVATION field is formatted as an integer number following the simple formatting pattern provided (for a full reference see the the <a href="http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html">Java DecimalFormat</a> documentation):</p>
<p><img class="alignnone size-full wp-image-471" title="contours" src="http://blog.geoserver.org/wp-content/uploads/contours.png" alt="contours" width="600" height="400" /></p>
<p>I hope you&#8217;ll find interesting and clever uses of the existing filter functions to improve the way you work with GeoServer. Next time I&#8217;ll show you my favourite one, which is also a new feature in GeoServer 2.0.1, called &#8220;geometry transformations&#8221;. Stay tuned to learn more about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2010/02/08/geoserver-hidden-treasures-filter-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ahora tenemos un grupo de discusión para la comunidad hispano-hablante</title>
		<link>http://blog.geoserver.org/2009/06/11/tenemos-una-lista-de-correo-en-espanol/</link>
		<comments>http://blog.geoserver.org/2009/06/11/tenemos-una-lista-de-correo-en-espanol/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 20:07:36 +0000</pubDate>
		<dc:creator>Rolando Peñate</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Polls]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[User perspectives]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=224</guid>
		<description><![CDATA[Here’s a quick announcement for all those who understand the above:  GeoServer now has a Spanish language users mailing list!  Created and moderated by core GeoServer developer Gabriel Roldán, the mailing list is a resource for those who would like assistance in all things GeoServer, but prefer to discuss in Spanish.  This marks the fourth [...]]]></description>
			<content:encoded><![CDATA[<p>Here’s a quick announcement for all those who understand the above:  GeoServer now has a <a href="http://groups.google.com/group/geoserver-es">Spanish language users mailing list</a>!  Created and moderated by core GeoServer developer Gabriel Roldán, the mailing list is a resource for those who would like assistance in all things GeoServer, but prefer to discuss in Spanish.  This marks the fourth language for which GeoServer has a mailing list (the others being <a href="http://geoserver.org/display/GEOS/Mailing+Lists">English</a>, <a href="http://tech.groups.yahoo.com/group/geoserver/">Portugese</a>, and <a href="http://groups.google.com/group/geoserver-ita">Italian</a>).</p>
<p>En respuesta a la creciente demanda de información e ímpetu de colaboración de usuarios de habla hispana, hemos creado un <a href="http://groups.google.com/group/geoserver-es">grupo de discusión</a> para la comunidad hispano-hablante donde puedes comunicarte con otros usuarios de GeoServer en español y discutir cualquier tema relacionado con el proyecto. Si quieres involucrarte activamente en el desarrollo de GeoServer puedes inscribirte en la <a rel="nofollow" href="https://lists.sourceforge.net/lists/listinfo/geoserver-devel">lista de desarrolladores</a> (en inglés).</p>
<p>We&#8217;re also looking for users to contribute documentation in Spanish, así que si quieres ayudar a escribir documentación en español dejanos saber.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2009/06/11/tenemos-una-lista-de-correo-en-espanol/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Follow the arrows</title>
		<link>http://blog.geoserver.org/2009/04/02/follow-the-arrows/</link>
		<comments>http://blog.geoserver.org/2009/04/02/follow-the-arrows/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 15:47:09 +0000</pubDate>
		<dc:creator>Mike Pumphrey</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[User perspectives]]></category>
		<category><![CDATA[street labels arrows SLD]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=191</guid>
		<description><![CDATA[Here&#8217;s a neat trick for those working with road maps that want to indicate traffic direction by way of appropriately pointed arrows. With text symbolizers using font characters, this is actually a snap, provided your data includes information about direction. The New York City streets data set has an attribute field called trafdir which specifies [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a neat trick for those working with road maps that want to indicate traffic direction by way of appropriately pointed arrows.  With <a href="http://blog.geoserver.org/2008/12/16/dynamic-symbolizers-part-2/" target=_blank>text symbolizers using font characters</a>, this is actually a snap, provided your data includes information about direction.</p>
<p>The <a href="http://www.nyc.gov/html/dcp/html/bytes/dwnlion.shtml" target=_blank>New York City streets</a> data set has an attribute field called <code>trafdir</code> which specifies the flow of traffic on one-way streets: </p>
<blockquote><p><strong>W</strong> &#8211; (&#8220;with&#8221;) One-way in the direction of ascending street numbers<br />
<strong>A</strong> &#8211; (&#8220;against&#8221;) One-way in the opposite direction of ascending street numbers</p></blockquote>
<p>With this in mind, all that is needed is an SLD with two rules, each rule drawing an arrow pointing in appropriate direction specified by the <code>trafdir</code> attribute.  Since arrows are included in most fonts, this can be accomplished using text symbolizers.  And since the text label is oriented relative to the lines themselves (due to <a href="http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/" target=_blank>labels that can follow curves</a>) the arrows will automatically be properly aligned with the road.</p>
<p>Here is one of the SLD rules.  The other rule is identical, except for the attribute value and the specific character used.</p>
<pre>
&lt;Rule&gt;
  &lt;ogc:Filter&gt;
    &lt;ogc:PropertyIsEqualTo&gt;
      &lt;ogc:PropertyName&gt;trafdir&lt;/ogc:PropertyName&gt;
      &lt;ogc:Literal&gt;W&lt;/ogc:Literal&gt;
    &lt;/ogc:PropertyIsEqualTo&gt;
  &lt;/ogc:Filter&gt;
  &lt;TextSymbolizer&gt;
    &lt;Label&gt;
      &lt;ogc:Literal&gt;&amp;#x2192;&lt;/ogc:Literal&gt;
    &lt;/Label&gt;
    &lt;Font&gt;
      &lt;CssParameter name="font-family"&gt;Lucida Sans&lt;/CssParameter&gt;
      &lt;CssParameter name="font-size"&gt;18&lt;/CssParameter&gt;
    &lt;/Font&gt;
    &lt;Fill&gt;
      &lt;CssParameter name="fill"&gt;#a4bdc5&lt;/CssParameter&gt;
    &lt;/Fill&gt;
  &lt;/TextSymbolizer&gt;
&lt;/Rule&gt;
</pre>
<p>&nbsp;</p>
<p>This trick was figured out by Jordan Anderson, author of <a href="http://www.ridethecity.com/" target=_blank>Ride The City</a>, who goes on to say:</p>
<blockquote><p><em>&#8220;Probably the most challenging thing was getting the correct balance between street name labels and arrow labels (which are on two different layers). I became intimately familiar with all the new labeling options and made use of spaceAround, maxDisplacement, and Repeat to get something close to the right balance.&#8221;</em></p></blockquote>
<p><a href='http://blog.geoserver.org/wp-content/uploads/oneway_arrows.png'><img src="http://blog.geoserver.org/wp-content/uploads/oneway_arrows-300x282.png" alt="" title="One-way arrows" width="300" height="282" class="alignnone size-medium wp-image-199" /></a></p>
<p>Looks pretty good to me.  Thanks Jordan!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2009/04/02/follow-the-arrows/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t just free your data, Swivel it</title>
		<link>http://blog.geoserver.org/2009/03/23/dont-just-free-your-data-swivel-it/</link>
		<comments>http://blog.geoserver.org/2009/03/23/dont-just-free-your-data-swivel-it/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 18:40:56 +0000</pubDate>
		<dc:creator>Mike Pumphrey</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[swivel csv mashup]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=189</guid>
		<description><![CDATA[Admit it. You love visualizing data. Mere tables do nothing for you, but the minute you can turn that into a map (or a graph or chart), information comes alive. I was recently turned on to Swivel, a website that allows you to upload, visualize, and share data. The main page provides a list of [...]]]></description>
			<content:encoded><![CDATA[<p>Admit it.  You love visualizing data.  Mere tables do nothing for you, but the minute you can turn that into a map (or a graph or chart), information comes alive.</p>
<p>I was recently turned on to <a href="http://www.swivel.com/" target=_blank><strong>Swivel</strong></a>, a website that allows you to upload, visualize, and share data.  The main page provides a list of some of the more recent data collections and, like so many great websites, my response to <a href="http://www.swivel.com/graphs/show/31792155" target=_blank>many of</a> <a href="http://www.swivel.com/graphs/show/31857326" target=_blank>those graphs</a> was interest piqued that I never knew I had.</p>
<p>I looked into the process of getting data on Swivel, and saw that one of the ways of uploading data was via a hosted <a href="http://en.wikipedia.org/wiki/Comma-separated_values" target=_blank>CSV</a> file.  And this was noteworthy, since with the release of <a href="http://blog.geoserver.org/2009/03/11/geoserver-173-released/" target=_blank>GeoServer 1.7.3</a>, CSV is newly available as an output format.</p>
<p>So, thinking of our perennial favorite, the topp:states layer (USA Population), I found my hosted version of GeoServer 1.7.3, and built the following request:</p>
<blockquote><p>http://MYGEOSERVER/wfs?service=wfs&#038;request=GetFeature&#038;typename=topp:states&#038;outputformat=csv</p></blockquote>
<p>As a refresher (or for those whose eyes glaze over at long GET requests), let&#8217;s briefly go over this:</p>
<blockquote><p>
<strong>service=wfs</strong> &#8211; Specifies a WFS request, so we should be getting back XML, not images.<br />
<strong>request=GetFeature</strong> &#8211; Asks for actual feature data from a layer, as opposed to information about that data (like in a GetCapabilities request).<br />
<strong>typename=topp:states</strong> &#8211; This specifies the layer to apply the request to, in this case, &#8220;topp:states&#8221;, the &#8220;Hello World&#8221; of GeoServer.<br />
<strong>outputformat=csv</strong> &#8211; This specifies the CSV output format.
</p></blockquote>
<p>Anyway, I flexed my fingers and pasted the above link into Swivel&#8217;s upload page.  In a few seconds, Swivel returned with a preview of the tabular data, to make sure that it was uploaded correctly (and to check things like delimiters and titles).</p>
<p><a href='http://blog.geoserver.org/wp-content/uploads/swivel1.png'><img src="http://blog.geoserver.org/wp-content/uploads/swivel1-300x223.png" alt="" width="300" height="223" class="alignnone size-medium wp-image-195" /></a></p>
<p>Swivel appears to have gotten everything right on the first try, so I continued on.  Next it asked me about title names, and to verify the data types on the columns (text/numbers/etc). </p>
<p><a href='http://blog.geoserver.org/wp-content/uploads/swivel3.png'><img src="http://blog.geoserver.org/wp-content/uploads/swivel3-300x223.png" alt="" title="swivel3" width="300" height="223" class="alignnone size-medium wp-image-197" /></a></p>
<p>Once again, Swivel appears to have needed no steering.  The next page asked for information about the data set.  (And I know when adding layers to GeoServer, we <em>never</em> skip this step, and always fill out the Name/Title/Abstract, right?)</p>
<p><a href='http://blog.geoserver.org/wp-content/uploads/swivel2.png'><img src="http://blog.geoserver.org/wp-content/uploads/swivel2-300x223.png" alt="" title="swivel2" width="300" height="223" class="alignnone size-medium wp-image-198" /></a></p>
<p>Then came to obligatory signup page (a smart thing to put at this step and not at the beginning, I might add) and then a long wait.  Finally, I was presented with the ability to decide which columns to set as the graph. I wanted to go for public transit usage as a function of total population (basically a graph of PUBTRANS/PERSONS vs. STATE_NAME) but Swivel didn&#8217;t provide for mathematical operations that I could find, , so I contented myself with <a href="http://www.swivel.com/graphs/show/31953999" target=_blank>a simple population graph</a>.</p>
<p><a href='http://blog.geoserver.org/wp-content/uploads/swivel4.png'><img src="http://blog.geoserver.org/wp-content/uploads/swivel4-300x299.png" alt="" title="swivel4" width="300" height="299" class="alignnone size-medium wp-image-194" /></a></p>
<p>The small point to make is that GeoServer can natively interact with many different applications, often in whimsical and unexpected ways.  The larger point is that our data is more than just dots on a map.  A robust data set, full of attributes and good metadata, can tell us stories, and the visualizations make the stories come alive.  After all, it&#8217;s the story that&#8217;s really important, not the data, when it comes down to it.</p>
<p><em>(If you link up your GeoServer to Swivel and come up with some nifty visualizations, please send us the links, so we can see what you&#8217;re up to!)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2009/03/23/dont-just-free-your-data-swivel-it/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GeoServer and OpenStreetMap</title>
		<link>http://blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap/</link>
		<comments>http://blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 18:40:17 +0000</pubDate>
		<dc:creator>Ivan Willig</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[OpenStreetMap]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=177</guid>
		<description><![CDATA[OpenStreetMap is a free and editable map of the world.  Founded in 2004 in the United Kingdom in response to the need for a free geospatial data source, it is a community-driven project, allowing for anyone to edit and contribute information.   It has since grown to include data from almost all countries in the world.  The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://openstreetmap.org" target="_blank">OpenStreetMap</a> is a free and editable map of the world.  Founded in 2004 in the United Kingdom in response to the need for a free geospatial data source, it is a community-driven project, allowing for anyone to edit and contribute information.   It has since grown to include data from almost all countries in the world.  The map generated from their data can be used as an alternative to commercial map layers such as those found in Google Maps.  The OpenStreetMap base layer is rendered using <a href="http://mapnik.org" target="_blank">Mapnik</a>, however since the data is free to download and distribute, it is possible to serve it using GeoServer.   I recently went through the process of rendering OpenStreetMap&#8217;s data with GeoServer.</p>
<p><strong>The data</strong></p>
<p>OpenStreetMap provides <a href="http://wiki.openstreetmap.org/index.php/Planet.osm" target="_blank">instructions on downloading their data</a>.  The full data set is a large file, currently about 4GB when compressed and about 100GB when uncompressed.  (You can <a href="http://downloads.cloudmade.com/" target="_blank">download sections of the data set</a> as well.)  This data is an XML-based data format that GeoServer cannot read natively.  <a href="http://postgis.refractions.net" target="_blank">PostGIS</a> is the optimal way of storing such a large volume of data when using GeoServer.  Luckily, there is a converter that allows you to load the OpenStreetMap data into PostGIS called <code>osm2pgsql</code>.  This program is a package available on Debian-based distributions (such as Ubuntu), and is also available as a binary on <a href="http://tile.openstreetmap.org/direct/osm2pgsql.zip" target="_blank">Windows</a><code>.<br />
</code></p>
<p>Run the following command:</p>
<p><code>osm2psql -E 900913 -d osm planet.osm</code></p>
<p>This will process the XML information and load the data into a PostGIS database called “osm”. The -E defines the projection of the source data, which in this case is 900913, the projection used in Google Maps, and the default for OpenStreetMap.</p>
<p>If successful, the database will contain the following tables:</p>
<p><code>planet_osm_line<br />
planet_osm_point<br />
planet_osm_polygon<br />
planet_osm_roads</code></p>
<p><strong>Making sense of the data</strong></p>
<p>OpenStreetMap&#8217;s data can be a bit confusing.  For a first time user like myself, just trying to figure out their naming convention was challenging.  They do, however, have a wonderful <a href="http://wiki.openstreetmap.org/wiki/Map_Features" target="_blank">map key</a> hidden away in their <a href="http://wiki.openstreetmap.org" target="_blank">wiki</a>.  This page is a lifesaver.</p>
<p>There are two different tables that contain line data, <code>planet_osm_line </code>and <code>planet_osm_roads</code>. The former includes railroads, subways, and other linear information.  The latter is made up exclusively of roads.  The <code>planet_osm_point</code> table has a range of data: subway stations, shopping centers, universities, and even brothels. Lastly the <code>planet_osm_polygon</code> table has, but is not limited to, parks, bodies of water, and even buildings in certain urban areas.</p>
<p><strong>Styling</strong></p>
<p><a href="http://blog.geoserver.org/wp-content/uploads/all-roads1.tiff"><img class="aligncenter size-medium wp-image-179" title="All Roads" src="http://blog.geoserver.org/wp-content/uploads/all-roads1.tiff" alt="" /></a></p>
<p>On my map I grouped the roads into three major groups; residential, secondary, and limited-access (highways).  To achieve this grouping I used the following SLD filters.</p>
<table border="1" cellspacing="5">
<tbody>
<tr>
<td><strong>Road class</strong></td>
<td><strong>PropertyName</strong></td>
<td><strong>Values</strong></td>
</tr>
<tr>
<td>Residential</td>
<td>highway</td>
<td>residential OR unclassified</td>
</tr>
<tr>
<td>Secondary</td>
<td>highway</td>
<td>primary OR secondary</td>
</tr>
<tr>
<td>Limited-access</td>
<td>highway</td>
<td>motorway OR trunk</td>
</tr>
</tbody>
</table>
<p>I then styled the map to distinctly display the three groups of roads, and also varied their widths depending on the zoom level.  This was the most time-consuming part of the process, as I needed to create and evaluate styles for each zoom level.  The <a href="http://blog.geoserver.org/wp-content/uploads/osm_roadssld.zip">final SLD</a> is very large, but is available for those interested.</p>
<p><strong>Final touches</strong></p>
<p>Since the purpose of this map was to create a viable base layer that anyone can incorporate into their mapping projects, performance was a concern.  To address this, I used <a href="http://geowebcache.org" target="_blank">GeoWebCache</a>, a tile cache mechanism built into GeoServer.  The <a href="http://geoserver.org/display/GEOSDOC/5.+GWC+-+GeoWebCache" target="_blank">GeoWebCache documentation</a> has details on this process.</p>
<p><strong>The finished (?) map</strong></p>
<p>The finished product can be found at <a href="http://demo.opengeo.org/openstreetmap " target="_blank">http://demo.opengeo.org/openstreetmap</a>.</p>
<p><a href="http://demo.opengeo.org/openstreetmap"><img class="aligncenter size-medium wp-image-180" title="OpenStreeMap data rendered with GeoServer" src="http://blog.geoserver.org/wp-content/uploads/all-roads-300x103.png" alt="" width="300" height="103" /></a></p>
<p>Feel free to link to this map.  Use this <a href="http://blog.geoserver.org/wp-content/uploads/openstreetmaphtml.zip">OpenLayers code</a> to get started.  This map is a work in progress.  Future enhancements will include adding public transportation systems, railroads, buildings, and more.  If you have any feedback on this map please email me at iwillig at opengeo dot org.</p>
<p>With GeoServer, PostGIS, OpenLayers and the OpenStreetMap data set, it is possible to build high-quality, professional-looking maps, allowing you to take control of what data you present, define your own mapping aesthetic, and free yourself from having to use commercial map layers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2009/01/30/geoserver-and-openstreetmap/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Throw GeoServer a curve (and it will be labeled)</title>
		<link>http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/</link>
		<comments>http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 20:49:42 +0000</pubDate>
		<dc:creator>Mike Pumphrey</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=166</guid>
		<description><![CDATA[Improvements to GeoServer are being made all the time, but to the average user, not all improvements are immediately discernible. However, recently a new feature has been added to GeoServer&#8217;s rendering algorithms, and all I can say is “wow.” I am referring to curved line labeling. Labels on lines have rendering challenges that points and [...]]]></description>
			<content:encoded><![CDATA[<p>Improvements to GeoServer are being made all the time, but to the average user, not all improvements are immediately discernible.  However, recently a new feature has been added to GeoServer&#8217;s rendering algorithms, and all I can say is “wow.”  I am referring to <strong>curved line labeling</strong>.</p>
<p>Labels on lines have rendering challenges that points and polygons do not.  This is because lines can curve.  Not officially, of course, but lines can be a collection of line segments, which meet at their edges but can be rotated with respect to each other.  The default behavior for a label is to appear parallel to the orientation of a line.  However, this can cause problems when the label resides along a curve, as the label will not follow it.  In some extreme cases, the label can appear only marginally connected to the line, which minimizes the effectiveness of the label!  Clearly, there was room for improvement.</p>
<p>This improvement was sponsored by <a href="http://trimet.org" target="_blank">TriMet</a>, the Portland, Oregon area transportation agency that uses GeoServer in their <a href="http://maps.trimet.org" target=_blank>Trip Planner</a>.  Lead GeoServer developer Andrea Aime tackled this task with his usual aplomb, and GeoServer now renders labels that follow curves.  Below is worth two thousand words:</p>
<p>
<a href='http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/nglineafter/' title='Curved Line Labels'><img width="150" height="150" src="http://blog.geoserver.org/wp-content/uploads/nglineafter-150x150.png" class="attachment-thumbnail" alt="Curved Line Labels" title="Curved Line Labels" /></a>
<a href='http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/nglinebefore/' title='Original Labels'><img width="150" height="150" src="http://blog.geoserver.org/wp-content/uploads/nglinebefore-150x150.png" class="attachment-thumbnail" alt="Original Labels" title="Original Labels" /></a>
<br />
<br/></p>
<p>This new road labeling is only in versions 1.7.1 and later.  Currently this functionality is not turned on by default, but is instead must be enabled in GeoServer.  One way of doing this is to edit your <code>web.xml</code> file inside the <code>WEB-INF</code> directory.  Stop your GeoServer instance, and insert the following code block:</p>
<blockquote><p><code>&lt;context-param&gt;<br />
&lt;param-name&gt;USE_NG_LABELLER&lt;/param-name&gt;<br />
&lt;param-value&gt;true&lt;/param-value&gt;<br />
&lt;/context-param&gt; </code></p></blockquote>
<p>In addition, you also need to edit your SLD to include a <code>VendorOption</code> inside your <code>TextSymbolizer</code>.  Add the following line:</p>
<blockquote><p><code>&lt;VendorOption name="followLine"&gt;true&lt;/VendorOption&gt;</code></p></blockquote>
<p>Restart your GeoServer, and you&#8217;re all set!</p>
<p>For me, the ability for GeoServer to output curved line labels is a huge step forward.  There&#8217;s something about these labels that make the map seem so much more professional.  Special thanks to TriMet for sponsoring this awesome new feature.  <a href="http://geoserver.org/display/GEOS/Stable">Have you tried it out yet?</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Raster Symbolizer tips &amp; tricks &#8211; part 2</title>
		<link>http://blog.geoserver.org/2008/12/18/raster-symbolizer-tips-tricks-part-2/</link>
		<comments>http://blog.geoserver.org/2008/12/18/raster-symbolizer-tips-tricks-part-2/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 14:36:59 +0000</pubDate>
		<dc:creator>Simone Giannecchini</dc:creator>
				<category><![CDATA[Developer notes]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[raster]]></category>
		<category><![CDATA[RasterSymbolizer]]></category>
		<category><![CDATA[SLD]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[wms]]></category>

		<guid isPermaLink="false">http://blog.geoserver.org/?p=160</guid>
		<description><![CDATA[A new post on the Raster Symbolizer tips &#38; tricks, this time I am going to show how to build an RGB image using 8 bits or unsigned 16 bits multi band coverages. I have been playing lately with some remote sensing data for the geoSDI project specifically the emissive subdataset coming from the  MODIS [...]]]></description>
			<content:encoded><![CDATA[<p>A new post on the Raster Symbolizer tips &amp; tricks, this time I am going to show how to build an RGB image using 8 bits or unsigned 16 bits multi band coverages.</p>
<p>I have been playing lately with some remote sensing data for the geoSDI project specifically the emissive subdataset coming from the  MODIS sensor on-board the TERRA satellite. A small sample dataset can be found <a href="http://geosdi.nsdi.it/geotif_16Band/EmissiveCampania.tif">here</a>. Its gdalinfo is here below:</p>
<p><span style="small;">Files: EmissiveCampania.tiff<br />
Size is 63, 156<br />
Coordinate System is:<br />
GEOGCS["WGS 84",<br />
DATUM["WGS_1984",<br />
SPHEROID["WGS 84",6378137,298.2572235630016,<br />
AUTHORITY["EPSG","7030"]],<br />
AUTHORITY["EPSG","6326"]],<br />
PRIMEM["Greenwich",0],<br />
UNIT["degree",0.0174532925199433],<br />
AUTHORITY["EPSG","4326"]]<br />
Origin = (13.742259882413393,41.506517193315830)<br />
Pixel Size = (0.032872864093301,-0.009584951678830)<br />
Metadata:<br />
AREA_OR_POINT=Area<br />
Image Structure Metadata:<br />
INTERLEAVE=BAND<br />
Corner Coordinates:<br />
Upper Left  (  13.7422599,  41.5065172) ( 13d44&#8217;32.14&#8243;E,<br />
Lower Left  (  13.7422599,  40.0112647) ( 13d44&#8217;32.14&#8243;E,<br />
Upper Right (  15.8132503,  41.5065172) ( 15d48&#8217;47.70&#8243;E,<br />
Lower Right (  15.8132503,  40.0112647) ( 15d48&#8217;47.70&#8243;E,<br />
Center      (  14.7777551,  40.7588910) ( 14d46&#8217;39.92&#8243;E,<br />
Band 1 Block=63&#215;65 Type=UInt16, ColorInterp=Gray<br />
NoData Value=65535<br />
Band 2 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 3 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 4 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 5 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 6 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 7 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 8 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 9 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 10 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 11 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 12 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 13 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 14 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 15 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535<br />
Band 16 Block=63&#215;65 Type=UInt16, ColorInterp=Undefined<br />
NoData Value=65535</span></p>
<p>The goal was to build a simple RGB on the fly (WCS usage is als envisioned, hence we could not just build it offline) by using bands 11, 9 and 1 respectively.</p>
<p>The style I have used for doing this is reported here below, it is a nice guideline in case you want to do something similar with Landsat data as an instance and create a false color image from the oiriginal dataset ( I might blog about that as well sooner or later <img src='http://blog.geoserver.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ).</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;StyledLayerDescriptor<br />
xmlns=&#8221;http://www.opengis.net/sld&#8221;<br />
xmlns:ogc=&#8221;http://www.opengis.net/ogc&#8221;<br />
xmlns:xlink=&#8221;http://www.w3.org/1999/xlink&#8221;<br />
xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221;<br />
xsi:schemaLocation=&#8221;http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd&#8221; version=&#8221;1.0.0&#8243;&gt;<br />
&lt;UserLayer&gt;<br />
&lt;Name&gt;raster_layer&lt;/Name&gt;<br />
&lt;LayerFeatureConstraints&gt;<br />
&lt;FeatureTypeConstraint/&gt;<br />
&lt;/LayerFeatureConstraints&gt;<br />
&lt;UserStyle&gt;<br />
&lt;Name&gt;raster&lt;/Name&gt;<br />
&lt;Title&gt;A boring default style&lt;/Title&gt;<br />
&lt;Abstract&gt;A sample style for rasters&lt;/Abstract&gt;<br />
&lt;FeatureTypeStyle&gt;<br />
&lt;FeatureTypeName&gt;Feature&lt;/FeatureTypeName&gt;<br />
&lt;Rule&gt;<br />
&lt;RasterSymbolizer&gt;<br />
&lt;Opacity&gt;1.0&lt;/Opacity&gt;<br />
&lt;ChannelSelection&gt;<br />
&lt;RedChannel&gt;<br />
&lt;SourceChannelName&gt;11&lt;/SourceChannelName&gt;<br />
&lt;/RedChannel&gt;<br />
&lt;GreenChannel&gt;<br />
&lt;SourceChannelName&gt;9&lt;/SourceChannelName&gt; &gt;<br />
&lt;/GreenChannel&gt;<br />
&lt;BlueChannel&gt;<br />
&lt;SourceChannelName&gt;1&lt;/SourceChannelName&gt;<br />
&lt;/BlueChannel&gt;<br />
&lt;/ChannelSelection&gt;<br />
&lt;/RasterSymbolizer&gt;<br />
&lt;/Rule&gt;<br />
&lt;/FeatureTypeStyle&gt;<br />
&lt;/UserStyle&gt;<br />
&lt;/UserLayer&gt;<br />
&lt;/StyledLayerDescriptor&gt;</p>
<p><a href="http://blog.geoserver.org/wp-content/uploads/wms1.jpeg"><img class="size-full wp-image-162" style="middle;" src="http://blog.geoserver.org/wp-content/uploads/wms1.jpeg" alt="RGB rendering of bands 11,9,1" width="500" height="333" /></a></p>
<p>Since we are here, I will also show another rendering we have set up which applies a user defined colormap to band 11 (emissive temperature) which ranges from blu to red. Here is the style:</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;StyledLayerDescriptor<br />
xmlns=&#8221;http://www.opengis.net/sld&#8221;<br />
xmlns:ogc=&#8221;http://www.opengis.net/ogc&#8221;<br />
xmlns:xlink=&#8221;http://www.w3.org/1999/xlink&#8221;<br />
xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221;<br />
xsi:schemaLocation=&#8221;http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd&#8221; version=&#8221;1.0.0&#8243;&gt;<br />
&lt;UserLayer&gt;<br />
&lt;Name&gt;raster_layer&lt;/Name&gt;<br />
&lt;LayerFeatureConstraints&gt;<br />
&lt;FeatureTypeConstraint/&gt;<br />
&lt;/LayerFeatureConstraints&gt;<br />
&lt;UserStyle&gt;<br />
&lt;Name&gt;raster&lt;/Name&gt;<br />
&lt;Title&gt;A boring default style&lt;/Title&gt;<br />
&lt;Abstract&gt;A sample style for rasters&lt;/Abstract&gt;<br />
&lt;FeatureTypeStyle&gt;<br />
&lt;FeatureTypeName&gt;Feature&lt;/FeatureTypeName&gt;<br />
&lt;Rule&gt;<br />
&lt;RasterSymbolizer&gt;<br />
&lt;Opacity&gt;1.0&lt;/Opacity&gt;<br />
&lt;ChannelSelection&gt;<br />
&lt;GrayChannel&gt;<br />
&lt;SourceChannelName&gt;11&lt;/SourceChannelName&gt;<br />
&lt;/GrayChannel&gt;<br />
&lt;/ChannelSelection&gt;<br />
&lt;ColorMap extended=&#8221;true&#8221;&gt;<br />
&lt;ColorMapEntry color=&#8221;#0000ff&#8221; quantity=&#8221;3189.0&#8243;/&gt;<br />
&lt;ColorMapEntry color=&#8221;#009933&#8243; quantity=&#8221;6000.0&#8243;/&gt;<br />
&lt;ColorMapEntry color=&#8221;#ff9900&#8243; quantity=&#8221;9000.0&#8243; /&gt;<br />
&lt;ColorMapEntry color=&#8221;#ff0000&#8243; quantity=&#8221;14265.0&#8243;/&gt;<br />
&lt;/ColorMap&gt;<br />
&lt;/RasterSymbolizer&gt;<br />
&lt;/Rule&gt;<br />
&lt;/FeatureTypeStyle&gt;<br />
&lt;/UserStyle&gt;<br />
&lt;/UserLayer&gt;<br />
&lt;/StyledLayerDescriptor&gt;</p>
<p>and here is the result:</p>
<p><a href="http://blog.geoserver.org/wp-content/uploads/wms11.jpeg"><img class="size-medium wp-image-163" style="middle;" src="http://blog.geoserver.org/wp-content/uploads/wms11-300x265.jpg" alt="Band 11 (emissive temperature) with colormap" width="300" height="265" /></a></p>
<p>Enjoy,</p>
<p>Simone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.geoserver.org/2008/12/18/raster-symbolizer-tips-tricks-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

