Display error using google maps tile server and Google Maps utility in PHP -


i have question regarding map tile server , coordinates conversion in google maps using google maps utility library.

my tile server accesses database thousands of gps coordinates (lat,lng), , every (lat,lng) point, checks if point inside geographical bounds of tile; if does, coordinates conversion (wgs84 -> mercator -> x,y offset inside tile) , paints corresponding pixel inside tile, using googlemapsutility library.

in terms of code, following:

$point = googlemaputility::getoffsetpixelcoords((float)$row['lat'], (float)$row['lng'], $zoom, $x, $y); 

which calls getoffsetpixelcoords function (and in turn functions below) library:

public static function getoffsetpixelcoords($lat,$lng,$zoom, $x, $y)      {         $pixelcoords = googlemaputility::getpixelcoords($lat, $lng, $zoom);         return new point(             $pixelcoords->x - $x * googlemaputility::tile_size,              $pixelcoords->y - $y * googlemaputility::tile_size         );     }   public static function getpixelcoords($lat, $lng, $zoom)      {         $normalised = googlemaputility::_tonormalisedmercatorcoords(googlemaputility::_tomercatorcoords($lat, $lng));         $scale = (1 << ($zoom)) * googlemaputility::tile_size;         return new point(             (int)($normalised->x * $scale),              (int)($normalised->y * $scale)         );     }  private static function _tonormalisedmercatorcoords($point)      {         $point->x += 0.5;         $point->y = abs($point->y-0.5);         return $point;     } 

ok, results. zoom level<13 works great, below example of tile in zoom level 11:

image1

however, tile in zoom level >13, following happens:

image2

which strange... pixels seem aligned ? @ first thought decimal resolution problem, resolution of data quite (stored double in mysql database, example, 35.6185989379883, 139.731994628906, , in php floats , doubles same thing...)

could me on how fix problem?

thanks in advance...

why use type casting on result of database query? in example of book googlemapsutility it's not there?


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -