====== Interoperability for web portrayal services : a use case with deegree3 ====== ===== Setting up a deegree3 workspace ===== * **creation of a FeatureStore** connected to a shapefile : * let's say the shapefiles are in the //DEEGREE_WORKSPACE_ROOT/data// directory * we create the //meteocities.xml// file in a //DEEGREE_WORKSPACE_ROOT/datasources/feature// directory * the FeatureStore is now identified by its filename //meteocities// EPSG:21781 ../../data/meteo/meteocities * **creation of a FeatureLayers** linked to our meteocities FeatureStore * we create the meteocitiesLyr.xml file in //DEEGREE_WORKSPACE_ROOT/layers// directory * the FeatureLayers is now identified by its filename //meteocitiesLyr// * it binds meteocities FeatureStore to a layer named meteocities * other options here : FeatureType, Filter meteocities meteocities Cities from switzerland with weather information * **creation of themes** defining a tree of layers * we create the //meteosuisse.xml// file in //DEEGREE_WORKSPACE_ROOT/themes// directory * the tree is linked to one or many FeatureLayers by FeatureStoreId (filename above) * each theme has an identifier that identifies the layer name displayed by the GetCapabilities operation * these themes are identified by the filename //meteosuisse// meteocitiesLyr Meteosuisse theme meteocities Meteosuisse cities meteocities * **creation of a deegreeWMS** configuration * we create the //mywms.xml// file in //DEEGREE_WORKSPACE_ROOT/services// directory * it is linked to one themes file meteosuisse * **let's test the WMS service ...** * may be you have to reload your active workspace from the deegree console * test a **GetCapabilites** operation : http://localhost:8080/services/mywms?service=WMS&request=GetCapabilities * the response shows the root Layer titled //Meteosuisse theme// and its concrete child Layer named //meteocities// on which we can now request a GetMap * test a **GetMap** operation on meteocities : http://localhost:8080/services?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=meteocities&SRS=EPSG:21781&BBOX=449413,47606,899958,311321&STYLES=&WIDTH=1000&HEIGHT=585&FORMAT=image/png * we can use the deegree WMS Viewer to explore all configured layers : http://localhost:8080/console/wms/wms.html * or use our own "hands-on" WMS GetMapper to clearly see the WMS parameters : * SERVICE=WMS * VERSION=1.1.1 * REQUEST=GetMap * SRS=EPSG:21781 * BBOX=449413,47606,899958,311321 **(notice: we get parameter values from the capabilities description)** * LAYERS=meteocities * STYLES= * WIDTH=1000 * HEIGHT=585 * FORMAT=image/png * **creation of a style ...** * behind the scene, deegree3 has a rendering engine that we can manipulate through a language * we can "program" styles with this cartographic language which is based on OGC Symbology Encoding * each of these behind the scene styles is also called a NamedStyle * we create the //pointSimple.xml// file in //DEEGREE_WORKSPACE_ROOT/styles// directory pointSimple Discover PointSymbolizer - a really simple circle point circle #FFFFFF #000000 2 6 * **change the defaut style of a layer ...** * each style has to be linked to a layer within the FeatureLayers file configuration * we modify //meteocitiesLyr.xml// and the new elements StyleRef and StyleStoreId * the StyleStoreId is the filename of the style in the //DEEGREE_WORKSPACE_ROOT/styles// directory * a layer can be linked from 0 to N StyleRef (when no explicit style is defined, deegree3 uses a default style) * as soon as at least one NamedStyle is explicitly defined it becomes the default style * test the change : reload deegree3 from the console and then recall the above WMS request with our WMS GetMapper ... meteocities Cities from switzerland with weather information pointSimple ... * **important to notice ...** * we have know a first NamedStyle "pointSimple" * it is also the default style (because it is the first declared style for the above FeatureLayer) * thus, invoking a WMS request with STYLES= or with STYLES=pointSimple produce the same result * the naming of the NamedStyle is given by the element defined within the * usually we set the same name for both the element and the filename * **be careful** when you copy/paste style files to be sure you adapt these names (that's a classic trap to forget !) ===== Discovering Symbology Encoging 1.1 further with NamedStyles ===== * **creation of another style dedicated to meteocities layer ...** * we create the //pointCities.xml// file in //DEEGREE_WORKSPACE_ROOT/styles// directory * within the cartographic rule we introduce a TextSymbolizer which offers feature labeling capacities * for each feature, the rule applies the PointSymbolizer + the TextSymbolizer * the style is dedicated to meteocities layer because it references specifically the attribute property named NAME that belongs to the underlying data * this PropertyName is used to represent dynamically the text of the label * see the commented part using a Literal, it will uses the text for all labels (not much useful alone) * the LabelPlacement can be controlled : in this case we do not want the text to overlap circle symbol * the Displacement is to consider relative to an anchor point within the label box (default anchor point is at the center of the label box) * you may take control on other parameters with the Halo element (see commented part) or the Font element to specify SvgParameter elements among "font-family", "font-style", "font-weight", and "font-size" (see deegree3 documentation to know which font-family are available) pointCities Discover PointSymbolizer - a simple point with a dynamic label circle #FFFFFF #000000 2 6 0 -10 #000000 * **linking pointCities NamedStyle to meteocities layer ...** * we add to //meteocitiesLyr XML file// a StyleRef with the StyleStoreId //pointCities// * test it : reload deegree3 and recall the above WMS request with our WMS GetMapper by setting STYLE to the NamedStyle "pointCities" ... meteocities Cities from switzerland with weather information pointSimple pointCities ... * **creation of one more FeatureStore ...** * we create the g4cantons98 connected to the shapefile //../../data/base/g4cantons98// (EPSG:21781) * **creation of one more Style ...** * we create the NamedStyle "polygonSimple" * we introduce the PolygonSymbolizer offering capacities to style polygon featuretype * at first, we set the outline with the Stroke element associated to its relevant SvgParameter elements like "stroke" (for the color), "stroke-opacity", "stroke-width", ... * with have no Fill element which means polygons are just transparent polygonSimple Transparent polygons only outlined #777777 * **creation of a FeatureLayer linking above FeatureStore and Style ...** * we create the //g4cantons98Lyr.xml // file connecting the //g4cantons98 // * we declare the //g4cantons98 // in link with //polygonSimple // * **addition of a Theme within meteosuisse.xml file of Themes ...** * link the //g4cantons98Lyr // * declare the //g4cantons98 // meteocitiesLyr g4cantons98Lyr Meteosuisse theme meteocities Meteosuisse cities meteocities g4cantons98 Cantons units g4cantons98 * **test the new layer with its default style ...** * we reload deegree3 from the console and go to our WMS Getmapper * we ask for LAYERS=g4cantons98 and STYLE= (or STYLE=polygonSimple which represents the same default style) * **creation of one more polygon style ...** * we create the NamedStyle "polygonBig" with a PolygonSymbolizer configured with the same color #DFE4E7 for both fill and stroke color (so as to hide cantons boundaries and simulate one big polygon for whole Switzerland) * we link this new "polygonBig" NamedStyle to the FeatureLayer "g4cantons98" * we test it by asking for LAYERS=g4cantons98 and STYLES=polygonBig * **creation of one more FeatureStore, one more Style and one more FeatureLayer ...** * we create the g4see98 connected to the shapefile //../../data/base/g4see98// (EPSG:21781) * we create the NamedStyle "polygonLightblue" with a PolygonSymbolizer configured with a fill and stroke color #B8DCEA * we create the //g4see98Lyr.xml // file connecting the //g4see98 // * we declare the //g4see98 // in link with //polygonLightblue // (we also link it with polygonSimple) * we don't forget to add a new Theme for this new FeatureLayer in the Themes configuration * we reload deegree3 from the console * we test everything with the WMS Getmapper by asking for LAYERS=g4see98 and STYLES=polygonLightblue * **let's test now the combination of three layers : g4cantons98 + g4see98 + meteocities ...** * with the WMS Getmapper we ask for * LAYERS=g4cantons98,g4see98,meteocities * STYLES=polygonBig,polygonLightblue,pointCities * we understand: why LAYERS and STYLES parameters are plurals and there is an ordered matching of layers and styles * **creation of one last FeatureStore, Style and FeatureLayer linkage ...** * we create the waterways connected to the shapefile //../../data/base/waterways// (EPSG:4326) * we create the NamedStyle "lineDashed" by introducing the LineSymbolizer which offer capacities to style a line * we create the //waterwaysLyr.xml // file connecting the //waterways // * we declare the //waterways // in link with //lineDashed // * we don't forget to add a new Theme for this new FeatureLayer in the Themes configuration * we reload deegree3 from the console * we test everything with the WMS Getmapper by asking for LAYERS=waterways and STYLES=lineDashed lineDashed Discover LineSymbolizer - a lightblue dashed line #B8DCEA 5 5 * **let's test now a complete combination of all layers ...** * with the WMS Getmapper we ask for * LAYERS=g4cantons98,g4see98,waterways,meteocities * STYLES=polygonBig,polygonLightblue,lineDashed,pointCities * **discovery of one more styling capicity, GraphicFill ...** * we create the NamedStyle "polygonWater" by introducing the use of GraphicFill element to fill polygons according to a graphic pattern * we add a StyleRef for this new style to g4see98 * it may be useful to uncomment the Halo element of our //pointCities style// (you will see) * we test it as usual ! * LAYERS=g4cantons98,g4see98,waterways,meteocities * STYLES=polygonBig,polygonWater,lineDashed,pointCities polygonWater Polygons filled with a graphic image/png #B8DCEA * **see below the intermediary result you should get ...** {{:ogo:ogo:resultpart1.png|}} * **creation of one more style introducing filtered rule ...** * we create the NamedStyle “pointFOSSGIS” based on our NamedStyle “pointCities” by adding a filtered Rule element * we add a StyleRef for this new style to meteocities * we have now two cartographic rules, each applies to a set of features : * the first rule applies only to the city of Rapperswil: by adding a filter to this rule (using the syntax), we select Rappelswils' feature by its ID=0 so as to control the rendering engine to apply an ExternalGraphic based PointSymbolizer to __that feature only__ * the second rule applies to all other features of the layer: by adding the element to this rule, we select all the other features that have not been selected by another filtered rule (here it means ID <> 0) and this is to control the rendering engine to apply our previous combination of PointSymbolizer/TextSymbolizer to all these other features * this logic is not different than the common if...then...else statment in programming * we test it as usual ! pointFOSSGIS Discover filtered Rule element ID 0 image/png 0.2 0.4 circle #FFFFFF #000000 2 6 0 -10 #000000 * **see below the final result you should get ...** {{:ogo:mapfossgis.png|}} ===== Part II : discovering Symbology Encoging 1.1 further with UserStyles ===== **Preliminary : before going to part II, we need to configure on last thing on our deegree3** * creation of a deegreeWMS configuration ... * we create the mywfs.xml file in DEEGREE_WORKSPACE_ROOT/services directory * it configure the WFS service so that all the underlying FeatureStore can be queried with EPSG:4326 and EPSG:21781 SRS * reload deegree3 from the console and test it by requesting : http://localhost:8080/services/mywfs?service=WFS&request=GetCapabilities urn:ogc:def:crs:EPSG::4326 urn:ogc:def:crs:EPSG::21781 **SLD/SE Part2** In the following part we will present the UserStyle SLD 1.1 mechanism for client customization while pursueing to discover styling capacities of SE 1.1. * go to [[SLD/SE Part2]] ...