Hi Harikumar,
Thanks for the detailed answer. The problem is that the style I want to use
isn't known until run-time, so it would not be possible to use pre-defined
styles. I want to for example change a symbols colour based on a database
field value which can change over time. This means it wouldn't be be
possible to use a fixed SLD file. Do you know if it's possible to do this at
all? Is there a way to pass the SLD XML directly to GeoServer without
needing to use file?
Best regards,
Jon-Paul.
On Wed, May 11, 2011 at 11:01 AM, Harikumar Reddy <[email protected]>wrote:
> Hi,
>
> I may not provide more insight than given below (provided information
> whatever is known to me)., but i hope you will get clarity how to implement
> dynamic sld for gis layers for multi lingual webgis applications.
>
> We can assign more than one styles to a GIS layer (but default SLD will be
> selected during geoserver layers configuration..for ex:- polygon for polygon
> layers, line for road layers, or point for point features). You may write
> need to write code in the program similar to given below.
>
> Note: even though default SLD is configured in Geoserver, required sld to
> be applied should be present in geoserver. naming of such sld like given
> below will not confuse developers while coding.
>
> The slds respective to each layer as follows.
>
> *layer*
>
> *sld*
>
> * *
>
> *English*
>
> *Hindi
> *
>
>
> gis:gis_sea
>
> gis_sea
>
> gis:gis_country
>
> gis_country
>
> gis:gis_footprint
>
> gis_footprint
>
> gis:gis_buildings
>
> gis_buildings
>
>
>
> gis:gis_city
>
> gis_city_en
>
> gis_city_hnd
>
> gis:gis_district
>
> gis_district_en
>
> gis_district_hnd
>
> gis:gis_towns
>
> gis_towns_en
>
> gis_towns_hnd
>
> gis:gis_roads
>
> gis_roads_en
>
> gis_roads_hnd
>
> if require, pass specific sld's as in order to apply dynamic styles to the
> respective layer locale selected.
>
> Eq 1 :
> ....
> ....
> map = new OpenLayers.Map ("map",options);
> var layers ='gis:gis_ind,'+
> 'gis_footprint,'+
> 'gms_landmarks,'+
> 'gis:gis_towns,'+
> 'gis:gis_roads,'+
> 'gms:gms_point_of_interest';
> var slds ='gis_ind,' +
> 'gis_footprint,'+
> 'gms_landmarks,'+
> 'gis_towns_'+ locale +','+
> 'gis_roads_'+ locale +','+
> 'gms_POI_'+ locale;
> var layer = new OpenLayers.Layer.WMS( "ind WMS", wmsUrl,{
> layers: layers,
> styles: slds,
> srs: 'EPSG:4326',format: 'image/png'},{'attribution': '© 2009
> Mapview'},{buffer: 0});
> map.addLayer( layer );
>
> Eq 2 :
> ....
> ....
> map = new OpenLayers.Map ("map",options);
> var layer1 = new OpenLayers.Layer.WMS( "Layer1", wmsUrl,{
> layers: 'gis:gis_ind',
> styles: 'gis_ind',
> srs: 'EPSG:4326',format: 'image/png'},{'attribution': '© 2009
> Mapview'},{buffer: 0});
> var layer2 = new OpenLayers.Layer.WMS( "Layer2", wmsUrl,{
> layers: 'gis:gis_towns',
> styles: 'gis_towns_'+ locale,
> srs: 'EPSG:4326',format: 'image/png'},{'attribution': '© 2009
> Mapview'},{buffer: 0});
> map.addLayers( [layer1, layer2] );
> In this example, the locale javascript object gets the respective language
> as 'en' or 'ar' and applies language specific style to the layer.
>
>
> @ Hari
>
>
> On Wed, May 11, 2011 at 2:13 PM, Jon-Paul Dobson
> <[email protected]>wrote:
>
>> Hi,
>>
>> Is there anyway to change layer styles on-the-fly other than to alter the
>> .SLD xml file? In our application I want to allow users to have the ability
>> to set personal layer styles e.g. colour, symbol etc.Is this possible at
>> all?
>>
>> If the only way to change styles is to alter the .SLD file, then this
>> means that layer styles must be set at the global level and personal
>> preferences per user would not be possible.
>>
>> Regards,
>> Jon-Paul.
>>
>>
>> ------------------------------------------------------------------------------
>> Achieve unprecedented app performance and reliability
>> What every C/C++ and Fortran developer should know.
>> Learn how Intel has extended the reach of its next-generation tools
>> to help boost performance applications - inlcuding clusters.
>> http://p.sf.net/sfu/intel-dev2devmay
>> _______________________________________________
>> Geoserver-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users