Latitude to Google tiles
I am looking for the pow(() and deg2rad() equivalent in FileMaker
I believe deg2rad() = lat * pi / 180.
The FileMaker Calculated Field:
/*floor((1 - log(tan(LL_Y * pi / 180) + 1 / cos(LL_Y * pi / 180)) / pi) /2 * pow(2, LAYER);*/
Is started with this below from a php example that works.
floor((1 - log(tan(deg2rad($lat)) + 1 / cos(deg2rad($lat))) / pi()) /2 * pow(2, $zoom));
More language examples here:
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
Thanks
LL_X = -149.348145; longitude
LAYER = 13; zoom level
answers should be
697 for xtile and 2311 for ytile;
I have the xtile working in FileMaker. I believe I am having problems with the deg2rad()conversion. Any help would be appreciated. Both PHP statements work perfectly in PHP.
The FM conversion for ytile is off by about a third.
PHP:
$ytile = floor((1 - log(tan(deg2rad($lat)) + 1 / cos(deg2rad($lat))) / pi()) /2 * pow(2, $zoom));
FM:
Floor((1 - Log(Tan( LL_Y * (Pi / 180)) + 1 / Cos(LL_Y * (Pi / 180))) / Pi) /2 * (2 ^ LAYER))
*/ The FileMaker conversion of the xtile works, so I believe I have the pow() correct. */
PHP:
$xtile = floor((($lon + 180) / 360) * pow(2, $zoom));
FM:
Floor(((LL_X + 180) / 360) * (2 ^ LAYER))