Hi all,
I am stuck here, some help would be very appreciated.
I am trying to create a layer style ( sld ) based in area of each geometry feature in a shapefile.
It is possible? If it is not, can i use the feature id to create a style?
For while i got the below code, that try to interpolate the area values as color gradients, but it isnt working. ( Looks like the area value is not being evaluated ).
<?xml version="1.0" encoding="UTF-8"?>
sld:NamedLayer
sld:NameCOLOR_MAP NAME</sld:Name>
sld:UserStyle
sld:NameCOLOR_MAP NAME</sld:Name>
sld:TitleCOLOR_MAP</sld:Title>
sld:FeatureTypeStyle
sld:Namename</sld:Name>
sld:Rule
sld:PolygonSymbolizer
sld:Fill
<sld:CssParameter name=“fill”>
<ogc:Function name=“Interpolate”>
<ogc:Function name=“area”>
ogc:PropertyNameCNTRY_NAME</ogc:PropertyName>
</ogc:Function>
ogc:Literal1</ogc:Literal>
ogc:Literal#0000FF</ogc:Literal>
ogc:Literal2</ogc:Literal>
ogc:Literal#005FFF</ogc:Literal>
ogc:Literal3</ogc:Literal>
ogc:Literal#00BFFF</ogc:Literal>
ogc:Literal4</ogc:Literal>
ogc:Literal#20FFDF</ogc:Literal>
ogc:Literal5</ogc:Literal>
ogc:Literal#80FF7F</ogc:Literal>
ogc:Literal6</ogc:Literal>
ogc:Literal#E0FF1F</ogc:Literal>
ogc:Literal7</ogc:Literal>
ogc:Literal#FFBE00</ogc:Literal>
ogc:Literal8</ogc:Literal>
ogc:Literal#FF0100</ogc:Literal>
ogc:Literalcolor</ogc:Literal>
</ogc:Function>
</sld:CssParameter>
</sld:Fill>
sld:Stroke
<sld:CssParameter name=“stroke”>#FFFFFF</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
Thanks!
The SLD your are using requires SE 1.1.
The common 1.0 approach is to write a rules for each value.
In any case I dubt that you have CNTRY_NAMEs called 1,2,3,4 … maybe would be better to change numbers with the country names.
···
Ing. Alessio Fabiani
@alfa7691
Founder/Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 331 6233686
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Thu, Dec 5, 2013 at 10:44 PM, Danilo da Silveira Figueira <danilomalzao@anonymised.com> wrote:
Hi all,
I am stuck here, some help would be very appreciated.
I am trying to create a layer style ( sld ) based in area of each geometry feature in a shapefile.
It is possible? If it is not, can i use the feature id to create a style?
For while i got the below code, that try to interpolate the area values as color gradients, but it isnt working. ( Looks like the area value is not being evaluated ).
<?xml version="1.0" encoding="UTF-8"?>
sld:NamedLayer
sld:NameCOLOR_MAP NAME</sld:Name>
sld:UserStyle
sld:NameCOLOR_MAP NAME</sld:Name>
sld:TitleCOLOR_MAP</sld:Title>
sld:FeatureTypeStyle
sld:Namename</sld:Name>
sld:Rule
sld:PolygonSymbolizer
sld:Fill
<sld:CssParameter name=“fill”>
<ogc:Function name=“Interpolate”>
<ogc:Function name=“area”>
ogc:PropertyNameCNTRY_NAME</ogc:PropertyName>
</ogc:Function>
ogc:Literal1</ogc:Literal>
ogc:Literal#0000FF</ogc:Literal>
ogc:Literal2</ogc:Literal>
ogc:Literal#005FFF</ogc:Literal>
ogc:Literal3</ogc:Literal>
ogc:Literal#00BFFF</ogc:Literal>
ogc:Literal4</ogc:Literal>
ogc:Literal#20FFDF</ogc:Literal>
ogc:Literal5</ogc:Literal>
ogc:Literal#80FF7F</ogc:Literal>
ogc:Literal6</ogc:Literal>
ogc:Literal#E0FF1F</ogc:Literal>
ogc:Literal7</ogc:Literal>
ogc:Literal#FFBE00</ogc:Literal>
ogc:Literal8</ogc:Literal>
ogc:Literal#FF0100</ogc:Literal>
ogc:Literalcolor</ogc:Literal>
</ogc:Function>
</sld:CssParameter>
</sld:Fill>
sld:Stroke
<sld:CssParameter name=“stroke”>#FFFFFF</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
Thanks!
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
On Fri, Dec 6, 2013 at 10:18 AM, Alessio Fabiani <
alessio.fabiani@anonymised.com> wrote:
The SLD your are using requires SE 1.1.
Nope, the filter function is also available for 1.0
The common 1.0 approach is to write a rules for each value.
In any case I dubt that you have CNTRY_NAMEs called 1,2,3,4 ... maybe
would be better to change numbers with the country names.
Agree... where is your data coming from? If the data is from a shapefile,
the geometry column name is "the_geom".
Mind, the function computes the area using cartesian geometry, it will not
work properly if your data is in geographic coordinates
Cheers
Andrea
--
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Thank you,
That is exacly what i was missing “the_geom” to get the geometry!
Sorry for my late reply,
Problem solved with:
<?xml version="1.0" encoding="UTF-8"?>
sld:NamedLayer
sld:NameGMI_CNTRY String Mapa_Mundi</sld:Name>
sld:UserStyle
sld:NameGMI_CNTRY String Mapa_Mundi</sld:Name>
sld:TitleGMI_CNTRY String</sld:Title>
sld:FeatureTypeStyle
sld:Namename</sld:Name>
sld:Rule
sld:PolygonSymbolizer
sld:Fill
<sld:CssParameter name=“fill”>
<ogc:Function name=“Interpolate”>
<ogc:Function name=“area”>
ogc:PropertyNamethe_geom</ogc:PropertyName>
</ogc:Function>
ogc:Literal100000</ogc:Literal>
ogc:Literal#0000FF</ogc:Literal>
ogc:Literal500000</ogc:Literal>
ogc:Literal#59FFA6</ogc:Literal>
ogc:Literal3000000</ogc:Literal>
ogc:Literal#FF0100</ogc:Literal>
ogc:Literalcolor</ogc:Literal>
</ogc:Function>
</sld:CssParameter>
</sld:Fill>
sld:Stroke
<sld:CssParameter name=“stroke”>#FFFFFF</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
···
2013/12/6 Andrea Aime <andrea.aime@anonymised.com>
On Fri, Dec 6, 2013 at 10:18 AM, Alessio Fabiani <alessio.fabiani@anonymised.com> wrote:
The SLD your are using requires SE 1.1.
Nope, the filter function is also available for 1.0
The common 1.0 approach is to write a rules for each value.
In any case I dubt that you have CNTRY_NAMEs called 1,2,3,4 … maybe would be better to change numbers with the country names.
Agree… where is your data coming from? If the data is from a shapefile, the geometry column name is “the_geom”.
Mind, the function computes the area using cartesian geometry, it will not work properly if your data is in geographic coordinates
Cheers
Andrea
–
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it