Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

GeoBox(latitude;longitude; radius)

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 3.8  (53 votes)
  Discuss this Custom Function

Steve Murray, Steve Murray
http://www.nurse.tv

Calculates latitude and longitude boundaries at radius of a location.

Sample Input:
GeoBox (35.0846 ; 106.6516 ; 20 )
Sample Output:
34.7955
35.3737
106.2983
107.0049


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

Use with your database of locations or addresses, each record having latitude and longitude geo data.
Given a longitude and latitude (ie. from a zip code db or geocode lookup) for your centerpoint and a radius in miles. This function will calculate boundary latitudes and longitudes, creating a box area for finding locations within the radius of the box's centerpoint. The result is delivered in a four member value list. (lat1¶lat2¶long1¶long2). Use FileMaker's GetValue function to retreive the values.

Typical Use:
You can use the values for a Find:
criteria: Latitude= lat1 ... lat2 AND Longitude = long1 ... long2.
Or you can create a multipredicate relationship to define the range and pull in related records.


Things to consider:
Due to the fact that we are using a box instead of a circle, there is margin of error here but acceptable for most applications, such as retail locations, delivery information, etc.

These calculations are generally accepted formulas for approximate (close enough) results. There are other, albeit more complex formulas if pinpoint accuracy is required.

If your DB containing geo location data contains negative values (ie. negative longitudes for western hemisphere), it is best to just remove the negative signs and make sure that all data represents absolute values. This is easier than adjusting calculation results or find requests for occurances of negative values in your fields. This is valid as long as your radius calcs do not involve more than one quadrant. For example, the North American quadrant is all north latitudes and west longitudes.

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

ddd

vvv, GeoBox (35.0846 ; 106.6516 ; 20 )
December 26, 2014 10:12am

Steve,

hello.
just added two more variables to your CF in order to adapt it to deal with negative values as well as miles and kilometers.

best regards,

/*
GeoBox( latitude ; longitude ; radius ; KmOrMiles ; roundVal )
"Km" for kilometers; any other value for miles
any numeric value (best if between 1~6) for roundVal
based on a CF written by Steve Murray

Steve Murray
http://www.nurse.tv
*/

Let (
[

convRadius =
Case (

KmOrMiles = "Km";
radius * 1.609344;
radius
);

signLati =
Case (
Left ( latitude ; 1 ) = "-";
"-"
);

signLong =
Case (
Left ( longitude ; 1 ) = "-";
"-"
);

stripLati = Filter ( latitude ; ".0123456789" );
stripLong = Filter ( longitude ; ".0123456789" );

lati01 = Round( stripLati - ( convRadius / 69.172 ) ; roundVal );
lati02 = Round( stripLati + ( convRadius / 69.172 ) ; roundVal );
long01 = Round( stripLong - ( convRadius / ( Cos( Radians( latitude ) ) * 69.172) ) ; roundVal );
long02 = Round( stripLong + ( convRadius / ( Cos( Radians( latitude ) ) * 69.172) ) ; roundVal )
];

signLati & lati01 & ¶ &
signLati & lati02 & ¶ &
signLong & long01 & ¶ &
signLong & long02
)

Edward, Victoria, BC, CA — Sao Paulo, SP, BR
December 07, 2015 2:30am

Best way to deal with this would be to change the middle section of the longer custom function to look like this:

signLati =
Case (
Latitude < 0;
"-"
);

signLong =
Case (
Longitude < 0;
"-"
);

Scott, Austin
August 30, 2017 12:12pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 2 + 8 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions