Solved

FileMaker Equivalent of pow()

Posted on 2013-06-20
7
356 Views
Last Modified: 2013-06-23
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
0
Comment
Question by:ALASKASTREETMASTER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:ALASKASTREETMASTER
ID: 39263976
LL_Y =  61.449269; latitude
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))
0
 
LVL 4

Expert Comment

by:historychef
ID: 39266163
FileMaker has a Radians( angleInDegrees ) function built in, so you don't need to write your own deg2rad() function.

Simple math gives you pow( x; n ) = exp( n * ln( x ) )
0
 
LVL 25

Assisted Solution

by:Will Loving
Will Loving earned 150 total points
ID: 39266547
I haven't dug into your math, but just FYI, FileMaker does have two functions that you might find useful here:

Degrees( )
Purpose: Converts angleInRadians to degrees.
Format: Degrees(angleInRadians)
http://www.filemaker.com/help/html/func_ref3.33.113.html#1033232

Radians( )
Purpose: Converts angleInDegrees to radians.
Format: Radians(angleInDegrees)
http://www.filemaker.com/help/html/func_ref3.33.115.html#1033314

And of course, I think you've figured out that Pow() is simply ^  so for example 2 cubed is 2^3 = 8
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ALASKASTREETMASTER
ID: 39268116
Thank you, I used the radians function but still get the same answer.  Must be something wrong with FM.

LL_Y =  59.57882161; latitude
LL_X = -151.43554688; longitude
LAYER = 11; zoom level

Longitude works fine in FileMaker.

The correct tile for Lat = 599 and is what PHP comes up with.  FM comes up with 839.

Does not work in FM
Floor((1 - Log(Tan(Radians(LL_Y)) + 1 / Cos(Radians(LL_Y))) / Pi) /2 *  (2 ^  LAYER) )

works in PHP

$ytile = floor((1 - log(tan(deg2rad($lat)) + 1 / cos(deg2rad($lat))) / pi()) /2 * pow(2, $zoom));
0
 
LVL 25

Expert Comment

by:Will Loving
ID: 39268135
The math looks the same so I'm wondering if it's an order of operations issue. Sometimes it can be useful to put extra parenthesis around sections that should be calculated together even if you think it should normally work based on standard order of operations.
0
 
LVL 4

Accepted Solution

by:
historychef earned 350 total points
ID: 39268887
There's nothing wrong with FileMaker in this case. FileMaker's "Log" function returns the log to the base 10. You need to use the "Ln" function in the latitude calculation for the natural log. (PHP's "log" function returns the natural log.)
0
 

Author Comment

by:ALASKASTREETMASTER
ID: 39269331
That worked!  Thank you all for your help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mysql ODBC Drivers for Mac 2 967
FM - Problem Printing Color from Filemaker 6 159
Filemaker xsl help please 3 113
Filemaker Pro 14 Advanced - Runtime Kiosk to FMpro Server 14 4 321
Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question