/** * Primary call to class that returns a google url to the custom static map * @param $lat * @param $lng * @param string $setting * @param array $override * @return string */ public function getMap($lat, $lng, $setting = 'default', $override = array()) { if ($setting == null) { $setting = 'default'; } $this->setMapConfig($setting, $override); $map = new StaticMap(); $map->setZoom($this->config["zoom"]); $map->setType($this->config["type"]); $map->setSize(new MapSize($this->config["width"], $this->config["height"])); $urlGenerator = new UrlGenerator(); $map->addMarker(new Marker(new Coordinate($lat, $lng), new MarkerStyle())); return $urlGenerator->generate($map); }
public function testMarkersCustomIconUrl() { $map = new StaticMap(); $map->setZoom(16)->setType(StaticMap::T_SATELLITE); $markerStyle = new MarkerStyle(); $markerStyle->setIcon('http://goo.gl/P7zYUu'); $map->addMarker(new Marker(new Coordinate(59.93863, 30.31413), $markerStyle)); $urlGenerator = new UrlGenerator(); $urlInfo = parse_url($urlGenerator->generate($map)); parse_str($urlInfo['query'], $queryParameters); $this->assertEquals('size:mid|icon:http://goo.gl/P7zYUu|59.93863000,30.31413000', $queryParameters['markers']); $this->assertEquals('59.93863000,30.31413000', $queryParameters['center']); $this->assertEquals('16', $queryParameters['zoom']); $this->assertEquals('600x300', $queryParameters['size']); $this->assertEquals('satellite', $queryParameters['maptype']); }