public static function getPixelOffsetInTile($lat, $lng, $zoom) { $pixelCoords = GoogleMapUtility::toZoomedPixelCoords($lat, $lng, $zoom); return new GoogleMapPoint($pixelCoords->x % GoogleMapUtility::$TILE_SIZE, $pixelCoords->y % GoogleMapUtility::$TILE_SIZE); }
protected function lngLatToPixels($lngLatPoints) { GoogleMapUtility::$TILE_SIZE = $this->tileSize; // points contain simple array of x,y,x,y,... $pointlist = array(); $pointcount = 0; foreach ($lngLatPoints as $coords) { $lng = $coords[0]; $lat = $coords[1]; $relativePixelPoint = GoogleMapUtility::toZoomedPixelCoords($lat, $lng, $this->zoom); $pointlist[] = $absolutePixelX = $relativePixelPoint->x - $this->tileSize * $this->pixelX + $this->offsetX; $pointlist[] = $absolutePixelY = $relativePixelPoint->y - $this->tileSize * $this->pixelY + $this->offsetY; $pointcount++; } return $pointlist; }