-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.php.sample
executable file
·223 lines (203 loc) · 8.74 KB
/
config.php.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
/**
* GFStaticMapLite
*
* Copyright 2017 Geofabrik GmbH
*
* This software is based on staticmapLite 0.02
*
* Copyright 2009 Gerhard Koch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require 'staticMapLiteDefaults.php';
Class configuredStaticMap extends staticMapLiteDefaults {
/**
* Available map tile sources.
*
* Define which map tile sources can be selected by the users using the
* `maptype` parameter. Requests without a `maptype` value, will use the
* source called `default`.
*
* The parameters `{X}`, `{Y}` and `{Z}` must be used in the URL
* and represent the X, Y and Z index of the map tiles.
*
* If a map tile source needs an API key and your clients provide it using
* the `api_key` URL parameter, you can forward it using the `{P}` placeholder.
* For example, if a user reuqests a map with
* http://staticmap.example.com/maptype=print150¢er=9,49&zoom=12&api_key=abcdef123,
* map tiles will be fetched from http://tile.example.com/retina/abcdef123/12/{X}/{Y}.png
* in the example given below.
*
* Following parameters are optional and only have to be set if the tile
* server needs them:
*
* * `{P}` API key. If the URL contains a variable string like an API key,
* insert `{P}` at the location where the API key would be inserted.
* The method configuredStaticMap->getApiKey() extracts the API key from
* the URL (see below).
*/
protected $tileSources = array(
'default' => array('url' => 'http://tile.example.com/standard/{P}/{Z}/{X}/{Y}.png', 'tileSize' => 256, 'useTileCache' => true),
'print150' => array('url' => 'http://tile.example.com/retina/{P}/{Z}/{X}/{Y}.png', 'tileSize' => 512, 'useTileCache' => true),
'print' => array('url' => 'http://tile.example.com/printtiles/{P}/{Z}/{X}/{Y}.png', 'tileSize' => 1024, 'useTileCache' => true)
);
/**
* Method which returns the API key supplied by the user which should be
* passed to the tile server.
*
* If your tile providers do not require API keys, just replace the
* implementation by a simple `return '';` or leave it as it is.
*
* See doc/api_keys.md for further details.
*/
protected function getApiKey() {
if (isset($_GET['apikey'])) {
return $_GET['apikey'];
}
return '';
}
/**
* Available markers.
*
* Changing $markerLookup will overwrite the default entries.
*
* The names of the markers must contain a slash. The part before the
* slash must match the tile sources defined in `$tileSources`. The
* part after the slash is the name of the marker used in the URL
* paramaters. If you define the tile sources 'default' and 'print150',
* `$markerLookup` needs to define all markers for both tile sources. FOr
* example, in order to support the marker called 'marker' for all three
* tile sources, you have to defined 'default/marker', 'print150/marker'
* and 'print/marker'. This allows you to define PNG images of different
* sizes for different resolutions.
*
* Properties:
*
* * `filename`: filename relative to the `$markerBaseDir` pointing to a
* greyscale image of the marker
* * `maskname`: filename relative to the `$markerBaseDir` pointing to a
* image whose black pixels will be filled with the marker color. The
* marker image (`filename` property) will be placed on top of it.
* * `width`: width of the marker
* * `height`: height of the marker
* * `hotx`: x coordinate of the "tip" of the marker
* * `hoty`: y coordinate of the tip of the marker
* * `textx`: x coordinate of the text label
* * `texty`: y coordinate of the text label
* * `textsize`: size of the text
* * `font`: font file to be used. This must be TTF font located in the
* fonts/ directory.
*/
// protected $markerLookup = array (
// 'default/marker' => array(
// 'filename' => 'default/marker.png',
// 'maskname' => 'default/marker_colorize.png',
// 'width' => 24,
// 'height' => 40,
// 'hotx' => 12,
// 'hoty' => 40,
// 'textx' => 12,
// 'texty' => 18,
// 'textsize' => 12,
// 'font' => 'LiberationSans-Bold.ttf',
// ),
// 'print150/marker' => array(
// 'filename' => 'print150/marker.png',
// 'maskname' => 'print150/marker_colorize.png',
// 'width' => 48,
// 'height' => 40,
// 'hotx' => 24,
// 'hoty' => 80,
// 'textx' => 24,
// 'texty' => 36,
// 'textsize' => 24,
// 'font' => 'LiberationSans-Bold.ttf',
// ),
// 'print/marker' => array(
// 'filename' => 'print/marker.png',
// 'maskname' => 'print/marker_colorize.png',
// 'width' => 96,
// 'height' => 80,
// 'hotx' => 48,
// 'hoty' => 160,
// 'textx' => 48,
// 'texty' => 72,
// 'textsize' => 48,
// 'font' => 'LiberationSans-Bold.ttf',
// )
// );
protected $tileDefaultSrc = 'cheapmapprovider';
/** Marker directory */
protected $markerBaseDir = 'images';
/** Font directory */
protected $fontBaseDir = 'fonts/';
/** Should downloaded tiles be cached on server side?
* This can be overwritten for some or all sources in the tileSources setting.
*/
protected $useTileCache = true;
/** Directory of the tile cache */
protected $tileCacheBaseDir = 'cache/tiles';
/** Should produced images ("maps") be cached on server side? */
protected $useMapCache = true;
/**
* Shold the map cache be ignored by default?
*
* This property will be overwritten if the user adds `nocache=true/false`
* to the query string if `$this->$ignoreCacheProperty` is se to true.
*/
protected $doNotReadMapCache = false;
/**
* Should staticmap.php ignore the `nocache=true/false` property of the
* query string? It is recommended to set this property to true to avoid DoS
* attacks but it hinders development if you use this instance for testing.
*/
protected $ignoreNoCacheProperty = false;
/** Directory of the cache of composed maps */
protected $mapCacheBaseDir = 'cache/maps';
protected $mapCacheID = '';
protected $mapCacheFile = '';
protected $mapCacheExtension = 'png';
/**
* Should an attribution text being added at the lower right corner of the
* image by default?
*/
protected $attribution = true;
/** Font of the attribution text */
protected $attributionFont = 'NotoSansUI-Regular';
/**
* Maximum number of tiles which should be fetched from a tile server to
* assemble an image.
*
* Any image whose width and height are smaller than 2*w (w is the width
* of a tile, usually 256 pixel) can be produced. Images can be larger than
* 2*w but not larger than 3*w if they skillfully placed that they do not
* intersect with too much tiles.
*
* Setting this property to 0 disables this check but allows your users
* to make your server a heavy user of the tile server.
*/
protected $maxTileCount = 9;
/**
* Maximum size of the map image.
*
* A request will fail if the width or the height of an image exceeds the
* maximum size or the maximum number of tile requests.
*/
protected $maxSize = 2048;
/**
* Error message returned to users if downloading map tiles from a tile server failed.
*/
protected $tileFetchFailureMessage = 'Failed to build your map image because downloading the tiles from the tile server failed. Please check if the tile server serves the tiles as expected and contact the administrator of this service if this error persists.';
}
?>