Skip to content

Commit 7c2a0bd

Browse files
committed
add tile size + create from bounding box
1 parent 5808877 commit 7c2a0bd

File tree

17 files changed

+462
-79
lines changed

17 files changed

+462
-79
lines changed

docs/classes/DantSu/OpenStreetMapStaticAPI/Circle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ Draw the circle on the map image.
127127

128128

129129
---
130-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
130+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Interfaces/Draw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141

4242

4343
---
44-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
44+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/LatLng.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ Get longitude
8282

8383

8484
---
85-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
85+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Line.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ Draw the line on the map image.
9999

100100

101101
---
102-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
102+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/MapData.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ DantSu\OpenStreetMapStaticAPI\MapData convert latitude and longitude to image pi
1919
- *(static)* [latToYTile](#lattoytile)
2020
- *(static)* [xTileToLng](#xtiletolng)
2121
- *(static)* [yTileToLat](#ytiletolat)
22+
- *(static)* [getCenter](#getcenter)
2223
- [__construct](#-__construct)
2324
- [getLatLngTopLeft](#-getlatlngtopleft)
2425
- [getLatLngTopRight](#-getlatlngtopright)
2526
- [getLatLngBottomLeft](#-getlatlngbottomleft)
2627
- [getLatLngBottomRight](#-getlatlngbottomright)
2728
- [getOutputSize](#-getoutputsize)
2829
- [getZoom](#-getzoom)
30+
- [getTileSize](#-gettilesize)
2931
- [getTileTopLeft](#-gettiletopleft)
3032
- [getTileBottomRight](#-gettilebottomright)
3133
- [getMapCropTopLeft](#-getmapcroptopleft)
@@ -49,6 +51,7 @@ Convert longitude and zoom to horizontal OpenStreetMap tile number and pixel pos
4951
|-----------|------|-------------|
5052
| `lon` | **float** | Longitude |
5153
| `zoom` | **int** | Zoom |
54+
| `tileSize` | **int** | Tile size |
5255

5356

5457
#### Return Value:
@@ -75,6 +78,7 @@ Convert latitude and zoom to vertical OpenStreetMap tile number and pixel positi
7578
|-----------|------|-------------|
7679
| `lat` | **float** | Latitude |
7780
| `zoom` | **int** | Zoom |
81+
| `tileSize` | **int** | Tile size |
7882

7983

8084
#### Return Value:
@@ -102,6 +106,7 @@ Convert horizontal OpenStreetMap tile number ad zoom to longitude.
102106
| `id` | **int** | Horizontal OpenStreetMap tile id |
103107
| `position` | **int** | Horizontal pixel position on tile |
104108
| `zoom` | **int** | Zoom |
109+
| `tileSize` | **int** | Tile size |
105110

106111

107112
#### Return Value:
@@ -129,6 +134,7 @@ Convert vertical OpenStreetMap tile number and zoom to latitude.
129134
| `id` | **int** | Vertical OpenStreetMap tile id |
130135
| `position` | **int** | Vertical pixel position on tile |
131136
| `zoom` | **int** | Zoom |
137+
| `tileSize` | **int** | Tile size |
132138

133139

134140
#### Return Value:
@@ -137,6 +143,32 @@ Convert vertical OpenStreetMap tile number and zoom to latitude.
137143

138144

139145

146+
---
147+
### ::getCenter
148+
149+
Get center between two coordinates.
150+
151+
152+
153+
* This method is **static**.
154+
155+
156+
157+
158+
#### Parameters:
159+
160+
| Parameter | Type | Description |
161+
|-----------|------|-------------|
162+
| `point1` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Vertical OpenStreetMap tile id |
163+
| `point2` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Vertical pixel position on tile |
164+
165+
166+
#### Return Value:
167+
168+
**\DantSu\OpenStreetMapStaticAPI\LatLng** : midpoint between the given coordinates
169+
170+
171+
140172
---
141173
### ->__construct
142174

@@ -156,6 +188,7 @@ Convert vertical OpenStreetMap tile number and zoom to latitude.
156188
| `centerMap` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | |
157189
| `zoom` | **int** | |
158190
| `outputSize` | **\DantSu\OpenStreetMapStaticAPI\XY** | |
191+
| `tileSize` | **int** | |
159192

160193

161194

@@ -274,6 +307,25 @@ Get the zoom
274307

275308

276309

310+
---
311+
### ->getTileSize
312+
313+
Get tile size
314+
315+
316+
317+
318+
319+
320+
321+
322+
323+
#### Return Value:
324+
325+
**int** : tile size
326+
327+
328+
277329
---
278330
### ->getTileTopLeft
279331

@@ -379,4 +431,4 @@ Convert a latitude and longitude to a XY pixel position in the image
379431

380432

381433
---
382-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
434+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Markers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ Draw markers on the image map.
135135

136136

137137
---
138-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
138+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/OpenStreetMap.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,76 @@ DantSu\OpenStreetMapStaticAPI\OpenStreetMap is a PHP library created for easily
1515

1616
## Methods
1717

18+
- *(static)* [createFromLatLngZoom](#createfromlatlngzoom)
19+
- *(static)* [createFromBoundingBox](#createfromboundingbox)
1820
- [__construct](#-__construct)
1921
- [addLayer](#-addlayer)
2022
- [addMarkers](#-addmarkers)
2123
- [addDraw](#-adddraw)
2224
- [getMapData](#-getmapdata)
2325
- [getImage](#-getimage)
2426

27+
### ::createFromLatLngZoom
28+
29+
Create new instance of OpenStreetMap.
30+
31+
32+
33+
* This method is **static**.
34+
35+
36+
37+
38+
#### Parameters:
39+
40+
| Parameter | Type | Description |
41+
|-----------|------|-------------|
42+
| `centerMap` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map center |
43+
| `zoom` | **int** | Zoom |
44+
| `imageWidth` | **int** | Width of the generated map image |
45+
| `imageHeight` | **int** | Height of the generated map image |
46+
| `tileLayer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
47+
| `tileSize` | **int** | Tile size in pixels |
48+
49+
50+
#### Return Value:
51+
52+
**\DantSu\OpenStreetMapStaticAPI\OpenStreetMap** :
53+
54+
55+
56+
---
57+
### ::createFromBoundingBox
58+
59+
Create new instance of OpenStreetMap.
60+
61+
62+
63+
* This method is **static**.
64+
65+
66+
67+
68+
#### Parameters:
69+
70+
| Parameter | Type | Description |
71+
|-----------|------|-------------|
72+
| `topLeft` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map top left |
73+
| `bottomRight` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map bottom right |
74+
| `padding` | **int** | Padding to add before top left and after bottom right position. |
75+
| `imageWidth` | **int** | Width of the generated map image |
76+
| `imageHeight` | **int** | Height of the generated map image |
77+
| `tileLayer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
78+
| `tileSize` | **int** | Tile size in pixels |
79+
80+
81+
#### Return Value:
82+
83+
**\DantSu\OpenStreetMapStaticAPI\OpenStreetMap** :
84+
85+
86+
87+
---
2588
### ->__construct
2689

2790
OpenStreetMap constructor.
@@ -41,7 +104,8 @@ OpenStreetMap constructor.
41104
| `zoom` | **int** | Zoom |
42105
| `imageWidth` | **int** | Width of the generated map image |
43106
| `imageHeight` | **int** | Height of the generated map image |
44-
| `tileServer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
107+
| `tileLayer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
108+
| `tileSize` | **int** | Tile size in pixels |
45109

46110

47111

@@ -169,4 +233,4 @@ Get the map image with markers and lines.
169233

170234

171235
---
172-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
236+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Polygon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ Draw the polygon on the map image.
100100

101101

102102
---
103-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
103+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/TileLayer.md

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ DantSu\OpenStreetMapStaticAPI\TileLayer define tile server url and related confi
1818
- *(static)* [defaultTileLayer](#defaulttilelayer)
1919
- [__construct](#-__construct)
2020
- [setOpacity](#-setopacity)
21+
- [setMaxZoom](#-setmaxzoom)
22+
- [getMaxZoom](#-getmaxzoom)
23+
- [setMinZoom](#-setminzoom)
24+
- [getMinZoom](#-getminzoom)
25+
- [checkZoom](#-checkzoom)
2126
- [getTileUrl](#-gettileurl)
2227
- [getAttributionText](#-getattributiontext)
2328
- [getTile](#-gettile)
@@ -88,6 +93,119 @@ Set opacity of the layer
8893

8994

9095

96+
---
97+
### ->setMaxZoom
98+
99+
Set a max zoom value
100+
101+
102+
103+
104+
105+
106+
107+
108+
#### Parameters:
109+
110+
| Parameter | Type | Description |
111+
|-----------|------|-------------|
112+
| `maxZoom` | **int** | |
113+
114+
115+
#### Return Value:
116+
117+
**$this** : Fluent interface
118+
119+
120+
121+
---
122+
### ->getMaxZoom
123+
124+
Get max zoom value
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
#### Return Value:
135+
136+
**int** :
137+
138+
139+
140+
---
141+
### ->setMinZoom
142+
143+
Set a min zoom value
144+
145+
146+
147+
148+
149+
150+
151+
152+
#### Parameters:
153+
154+
| Parameter | Type | Description |
155+
|-----------|------|-------------|
156+
| `minZoom` | **int** | |
157+
158+
159+
#### Return Value:
160+
161+
**$this** : Fluent interface
162+
163+
164+
165+
---
166+
### ->getMinZoom
167+
168+
Get min zoom value
169+
170+
171+
172+
173+
174+
175+
176+
177+
178+
#### Return Value:
179+
180+
**int** :
181+
182+
183+
184+
---
185+
### ->checkZoom
186+
187+
Check if zoom value is between min zoom and max zoom
188+
189+
190+
191+
192+
193+
194+
195+
196+
#### Parameters:
197+
198+
| Parameter | Type | Description |
199+
|-----------|------|-------------|
200+
| `zoom` | **int** | Zoom value to be checked |
201+
202+
203+
#### Return Value:
204+
205+
**int** :
206+
207+
208+
91209
---
92210
### ->getTileUrl
93211

@@ -153,6 +271,7 @@ Get an image tile
153271
| `x` | **float** | |
154272
| `y` | **float** | |
155273
| `z` | **int** | |
274+
| `tileSize` | **int** | |
156275

157276

158277
#### Return Value:
@@ -165,4 +284,4 @@ Get an image tile
165284

166285

167286
---
168-
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
287+
> Automatically generated from source code comments on 2023-07-30 using [phpDocumentor](http://www.phpdoc.org/)

0 commit comments

Comments
 (0)