Project

General

Profile

MapRestServiceIdeas » History » Version 4

Andreas Kohlbecker, 12/02/2008 04:58 PM

1 1 Andreas Kohlbecker
2
## Wild and tame ideas for the EDIT Map REST Service API
3
4
5
6
## Area Styles
7
8
9 4 Andreas Kohlbecker
 **Andreas Kohlbecker - 27.10.2008, 03.11.2008** 
10 2 Andreas Kohlbecker
11
12 1 Andreas Kohlbecker
I would prefer a more generic syntax for specifying area styles. First of all I'd like to explain why I think that the Geo REST Service would benefit from a more generic syntax.
13
14
15
Let's assume a situation in which a map should express different kind of information, e.g. distribution, soil characteristics, etc.. In this case one would likely want to express the different kind of information by
16
17
18
 a) the polygon border style  by b) the fill colour of the polygon, c) by a pattern drawn a foreground of the polygon. So we would have to handle arbitrary combinations of the different styles. 
19
20
21
Now if we define the polygon border style, fill colour and the color and pattern drawn in the foreground together in on area style attribute, we would have to define every combination of these individually. This would not only bloat up the style definition but would also bloat up the legend by requiring a <style_label> for each style combination thus introducing redundancy. Therefore I recommend splitting the definitions for 
22
23
24
 
25
26
* polygon border style
27
28
* background fill colour 
29
30
* foreground color and pattern
31
32
33
34
The API proposal already is designed that way: 
35
36
~~~
37
  (area style) as=<area style id>:<color>[,<style_label>]|..              -  defines a background (fill) color for a shape
38
 
39
               as=<area style id>:<pattern id><color>[,<style_label>]|.. -  defines a pattern and foreground color to fill a shape with
40
~~~
41
You can define separate area styles for background and foreground and you can apply arbitrary combinations of these to an area:
42
43
44
~~~
45
(area data) ad=<layer name>:<area style ids>:<area id>,..|<area style ids>:<area id>,..||<layer name>:<area style ids>:<area id>,..|
46
<area style ids> is a string of one letter [a-z,A-Z] area style ids
47
~~~
48
49
The polygon border style however is missing in the API, but we have the 
50
51
~~~
52
(layer style) ls=<layer_style_id>:[<line_color>][,<line_width>][,<stroke_style_id>]|..
53
~~~
54
55
Which is nothing else but a polygon border style applied to all polygons defined in one layer. Maybe we should rename layer style into area border style ?
56
57
58
And split area style into area background style and area foreground style then we would have the following attributes:
59
60
~~~
61
(area background  style) abs=<area style id>:<color>[,<style_label>]|..              -  defines a background (fill) color for a shape
62
 
63
(area foreground style)  afs=<area style id>:<pattern id><color>[,<style_label>]|.. -  defines a pattern and foreground color to fill a shape with
64
 
65
(area polygone style)    aps=<area style id>:[<line_color>][,<line_width>][,<stroke_style_id>][,<style_label>]|.
66
~~~
67
68
The in the currently proposed syntax does not allow using named colors, otherwise the attribute values can not be parsed, so I am using the rgb hex values here
69
70
71
 
72
73
abs=a:aaaaaa|b:ffff00
74
75
aps=c:0000ff,dotted,4|d:0000ff,no-dotted,10| e:00ff00,no-dotted,10
76
77
78
79
area border styles would be also applicable to layers: 
80
81
~~~
82
(layer) l=<layer name>[:[<area style id>][,<shp file url>][,<raster data url>]]|...
83
~~~
84
85
The layer attribute only would accept <area style id>s which actually are area border styles .
86
87
88
89
The the currently proposed syntax does not allow using named colors, otherwise the attribute values can not be parsed, so I am using the rgb hex values here
90
91
~~~
92
abs=a:aaaaaa|b:ffff00
93
aps=c:0000ff,dotted,4|d:0000ff,no-dotted,10| e:00ff00,no-dotted,10
94
~~~
95
Now lets take the styles from your example and express them by combinations of a, b, c, d, e 
96
97
~~~
98
grey,blue,4,dotted = ac
99
grey,blue,10,no-dotted = ad
100
yellow,green,10-no-dotted = be
101
~~~
102
So you would use these combinations of area styles in
103
104
~~~
105
(area data) ad=<layer name>:<area style ids>:<area id>,..|
106
~~~
107
The advantage I see in this approach are the better legends you can create eg:
108
109
110
~~~
111
abs=a:aaaaaa,arid|b:ffff00,semiarid
112
aps=c:0000ff,dotted,4,native|d:0000ff,no-dotted,10,cultivated| e:00ff00,no-dotted,10, abandoned
113
~~~
114
would result in a legend like which explains all possible combinations without the need to explicitly mentioning every one:
115
116
117
~~~
118
[  ] : arid
119
[  ] : semiarid
120
[  ] : native
121
[  ] : cultivated
122
[  ] : abandoned
123
~~~