470,815 Members | 1,090 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

question about radius searches

Hi Group, I'm trying to use the longitude and latitude to do a radius
search but I'm getting some inaccurate results, below is the code and I
was wondering if anyone knows weather or not I'm doing the calculations any
feed back is much appreciated. Thanks Todd
class RadiusAssistant {

var $maxLat;
var $minLat;
var $maxLong;
var $minLong;

function RadiusAssistant($Latitude, $Longitude, $Miles) {
global $maxLat,$minLat,$maxLong,$minLong;
$EQUATOR_LAT_MILE = 69.172;
$maxLat = $Latitude + $Miles / $EQUATOR_LAT_MILE;
$minLat = $Latitude - ($maxLat - $Latitude);
$maxLong = $Longitude + $Miles / (cos($minLat * M_PI / 180) *
$EQUATOR_LAT_MILE);
$minLong = $Longitude - ($maxLong - $Longitude);
}

function MaxLatitude() {
return $GLOBALS["maxLat"];
}
function MinLatitude() {
return $GLOBALS["minLat"];
}
function MaxLongitude() {
return $GLOBALS["maxLong"];
}
function MinLongitude() {
return $GLOBALS["minLong"];
}

}
Jul 17 '05 #1
1 1477
"Stormkid" <ba*****@goldengate.net> wrote in message news:<40***********************@newsreader.goldeng ate.net>...
Hi Group, I'm trying to use the longitude and latitude to do a radius
search but I'm getting some inaccurate results, below is the code and I
was wondering if anyone knows weather or not I'm doing the calculations any
feed back is much appreciated. Thanks Todd

<snip>

1. http://www.census.gov/cgi-bin/geo/gisfaq?Q5.1
2. http://www.phparchitect.com/sample.p...show=316&mid=9

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Xenophobe | last post: by
1 post views Thread by Marek Mänd | last post: by
4 posts views Thread by John Cho | last post: by
24 posts views Thread by arcticool | last post: by
3 posts views Thread by bayan1 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.