Project

General

Profile

MapRestServiceIdeas » History » Version 3

Andreas Kohlbecker, 12/02/2008 04:57 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 2 Andreas Kohlbecker
10 3 Andreas Kohlbecker
### Andreas Kohlbecker - 27.10.2008, 03.11.2008
11 2 Andreas Kohlbecker
12
13 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.
14
15
16
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
17
18
19
 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. 
20
21
22
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 
23
24
25
 
26
27
* polygon border style
28
29
* background fill colour 
30
31
* foreground color and pattern
32
33
34
35
The API proposal already is designed that way: 
36
37
~~~
38
  (area style) as=<area style id>:<color>[,<style_label>]|..              -  defines a background (fill) color for a shape
39
 
40
               as=<area style id>:<pattern id><color>[,<style_label>]|.. -  defines a pattern and foreground color to fill a shape with
41
~~~
42
You can define separate area styles for background and foreground and you can apply arbitrary combinations of these to an area:
43
44
45
~~~
46
(area data) ad=<layer name>:<area style ids>:<area id>,..|<area style ids>:<area id>,..||<layer name>:<area style ids>:<area id>,..|
47
<area style ids> is a string of one letter [a-z,A-Z] area style ids
48
~~~
49
50
The polygon border style however is missing in the API, but we have the 
51
52
~~~
53
(layer style) ls=<layer_style_id>:[<line_color>][,<line_width>][,<stroke_style_id>]|..
54
~~~
55
56
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 ?
57
58
59
And split area style into area background style and area foreground style then we would have the following attributes:
60
61
~~~
62
(area background  style) abs=<area style id>:<color>[,<style_label>]|..              -  defines a background (fill) color for a shape
63
 
64
(area foreground style)  afs=<area style id>:<pattern id><color>[,<style_label>]|.. -  defines a pattern and foreground color to fill a shape with
65
 
66
(area polygone style)    aps=<area style id>:[<line_color>][,<line_width>][,<stroke_style_id>][,<style_label>]|.
67
~~~
68
69
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
70
71
72
 
73
74
abs=a:aaaaaa|b:ffff00
75
76
aps=c:0000ff,dotted,4|d:0000ff,no-dotted,10| e:00ff00,no-dotted,10
77
78
79
80
area border styles would be also applicable to layers: 
81
82
~~~
83
(layer) l=<layer name>[:[<area style id>][,<shp file url>][,<raster data url>]]|...
84
~~~
85
86
The layer attribute only would accept <area style id>s which actually are area border styles .
87
88
89
90
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
91
92
~~~
93
abs=a:aaaaaa|b:ffff00
94
aps=c:0000ff,dotted,4|d:0000ff,no-dotted,10| e:00ff00,no-dotted,10
95
~~~
96
Now lets take the styles from your example and express them by combinations of a, b, c, d, e 
97
98
~~~
99
grey,blue,4,dotted = ac
100
grey,blue,10,no-dotted = ad
101
yellow,green,10-no-dotted = be
102
~~~
103
So you would use these combinations of area styles in
104
105
~~~
106
(area data) ad=<layer name>:<area style ids>:<area id>,..|
107
~~~
108
The advantage I see in this approach are the better legends you can create eg:
109
110
111
~~~
112
abs=a:aaaaaa,arid|b:ffff00,semiarid
113
aps=c:0000ff,dotted,4,native|d:0000ff,no-dotted,10,cultivated| e:00ff00,no-dotted,10, abandoned
114
~~~
115
would result in a legend like which explains all possible combinations without the need to explicitly mentioning every one:
116
117
118
~~~
119
[  ] : arid
120
[  ] : semiarid
121
[  ] : native
122
[  ] : cultivated
123
[  ] : abandoned
124
~~~