Project

General

Profile

MapRestServiceIdeas » History » Version 1

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