Skip to content

Commit ca03546

Browse files
committed
Change OpenStreetMap::__construct() params
1 parent 15e6dd1 commit ca03546

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHP OpenStreetMap Static API
22

3-
PHP library to easily get static image from OpenStreetMap (OSM), add markers and draw lines.
3+
PHP library to easily get static image from Open Street Map with markers and lines.
44

55
## ✨ Supporting
66

docs/classes/DantSu/OpenStreetMapStaticAPI/OpenStreetMap.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ OpenStreetMap constructor.
147147
|-----------|------|-------------|
148148
| `centerMap` | **\DantSu\OpenStreetMapStaticAPI\LatLng** | Latitude and longitude of the map center |
149149
| `zoom` | **int** | Zoom |
150-
| `outputPxSize` | **\DantSu\OpenStreetMapStaticAPI\XY** | Width and height of the generated map image |
150+
| `imageWidth` | **int** | Width of the generated map image |
151+
| `imageHeight` | **int** | Height of the generated map image |
151152

152153

153154

src/OpenStreetMap.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ public static function yTileToLat(int $y, int $zoom): float
8080
* OpenStreetMap constructor.
8181
* @param LatLng $centerMap Latitude and longitude of the map center
8282
* @param int $zoom Zoom
83-
* @param XY $outputPxSize Width and height of the generated map image
83+
* @param int $imageWidth Width of the generated map image
84+
* @param int $imageHeight Height of the generated map image
8485
*/
85-
public function __construct(LatLng $centerMap, int $zoom, XY $outputPxSize)
86+
public function __construct(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight)
8687
{
8788
$this->zoom = $zoom;
89+
$outputPxSize = new XY($imageWidth, $imageHeight);
8890

8991
$x = static::lngToXTile($centerMap->getLng(), $zoom);
9092
$y = static::latToYTile($centerMap->getLat(), $zoom);

src/samples/resources/marker.png

464 Bytes
Loading

src/samples/sample1.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99

1010
use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
1111
use \DantSu\OpenStreetMapStaticAPI\LatLng;
12-
use \DantSu\OpenStreetMapStaticAPI\XY;
1312
use \DantSu\OpenStreetMapStaticAPI\Line;
1413
use \DantSu\OpenStreetMapStaticAPI\Markers;
1514

1615
header('Content-type: image/png');
17-
(new OpenStreetMap(new LatLng(44.351933, 2.568113), 18, new XY(600, 400)))
16+
(new OpenStreetMap(new LatLng(44.351933, 2.568113), 18, 600, 400))
1817
->addMarkers(
1918
(new Markers(__DIR__ . '/resources/marker.png'))
2019
->addMarker(new LatLng(44.351933, 2.568113))

0 commit comments

Comments
 (0)