OpenLayers OpenLayers

Ticket #1542 (closed feature: fixed)

Opened 4 months ago

Last modified 3 months ago

Format.SLD: add support for TextSymbolizer

Reported by: bartvde Assigned to: tschaub
Priority: minor Milestone: 2.7 Release
Component: Format.SLD Version: 2.6
Keywords: Cc:
State: Complete

Description

I'll create a patch to add support for TextSymbolizer.

Attachments

ticket1542.patch (2.4 kB) - added by bartvde on 05/08/08 06:58:55.
patch implementing write support for TextSymbolizer
text.patch (5.5 kB) - added by tschaub on 06/06/08 03:19:18.
write text symbolizers with support for label expressions

Change History

05/08/08 06:56:01 changed by bartvde

  • keywords set to review.

It does not really make sense to implement read support right now, since vector layers can't render labels as yet.

Write support makes sense IMHO as you can now easily label a WMS layer using SLD.

An example useage is:

    var symbolizer = {};
    symbolizer["Text"] = {property: propertyName, fontFamily: fontFamily,
        fontSize: fontSize, fillColor: color};

Which will create something like (when used in an SLD document):

<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><NamedLayer><Name>AAA64</Name><UserStyle><FeatureTypeStyle><Rule><Name>default</Name><TextSymbolizer><Label><ogc:PropertyName xmlns:ogc="http://www.opengis.net/ogc">ROUTE</ogc:PropertyName></Label><Font><CssParameter name="font-family">Arial</CssParameter><CssParameter name="font-size">10</CssParameter></Font><Fill><CssParameter name="fill">#FFFF00</CssParameter></Fill></TextSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>

05/08/08 06:58:55 changed by bartvde

  • attachment ticket1542.patch added.

patch implementing write support for TextSymbolizer

05/14/08 07:51:34 changed by bartvde

  • keywords deleted.
  • state set to Review.

05/14/08 09:07:24 changed by bartvde

  • milestone set to 2.7 Release.

06/06/08 03:19:18 changed by tschaub

  • attachment text.patch added.

write text symbolizers with support for label expressions

06/06/08 03:24:30 changed by tschaub

Hey Bart - This is a nice addition. I think we'll eventually want to support more ogc:expressions. With that in mind, I decided a "label" property in the text symbolizer would more closely fit the sld:Label element. This parser has support for limited expression handling, so you can do something like:

var symbolizer = {
    "Text": {
        "label": "There are ${population} people in ${state}.",
        "fontFamily": "Arial" // etc
    }
};

I also added a test to demonstrate it working. Let me know if this works for you.

06/06/08 15:14:41 changed by ahocevar

  • state changed from Review to Commit.
  • type changed from task to feature.

Great work Bart and Tim! I can confirm that tests pass in FF2 and IE7, and that the patch does not interfer with existing code. Also, is an important contribution to make SLD read/write support more complete. Tim, please commit.

06/09/08 13:18:35 changed by tschaub

  • status changed from new to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [7333]) Adding support for TextSymbolizer writing in the SLD format. Thanks to Bart for the original patch. This provides basic expression handling for text labels. Read support later. r=ahocevar (closes #1542)