Der Martin: Kuriose Umkreissuche

Beitrag lesen

Hi,

wenn ich einmal davon ausgehe, das ich nicht einem grundsätzlichem Verständnisproblem aufgesessen bin und meine Mathematik-Kenntnisse nicht ganz falsch sind....

das wäre noch zu hinterfragen. ;-)

function getlatlang($location) {

> 	$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='. urlencode($location) .'&sensor=false');
>     $output= json_decode($geocode);
>     return $output->results[0]->geometry->location;
> }
> 
> if($search_Location!='') {
> 	$objlocation = getlatlang($search_Location);
> 	$latitude = $objlocation->lat;
> 	$longitude = $objlocation->lng;
> 
> 	
> 	$range = $search_Distance;
> 	if($latitude != "" && $longitude != "") {
> 		$lat_range = $range/69.172;
> 		$lon_range = abs($range/(cos($latitude) * 69.172));
> 		$min_lat = number_format($latitude - $lat_range, "4", ".", "");
> 		$max_lat = number_format($latitude + $lat_range, "4", ".", "");
> 		$min_lon = number_format($longitude - $lon_range, "4", ".", "");
> 		$max_lon = number_format($longitude + $lon_range, "4", ".", "");
> 		$zusatzqu.=" AND (poslat BETWEEN '".$min_lat."' AND '".$max_lat."' AND poslon BETWEEN '".$min_lon."' AND '".$max_lon."')";
> 	}
> }

Wofür  steht in diesem Codeauszug die magische Konstante 69.172? Abgesehen davon sieht dein Algorithmus os aus, als funktioniere er nur für bestimmte geographische Breiten. Für polnahe Bereiche jedenfalls nicht. Aber das ist vermutlich eine Einschränkung, die man in Kauf nehmen kann.

Und trotzdem schreit deine Berechnung noch nach einer Erklärung.

So long,  Martin

--
Es gibt Dinge, die sind sooo falsch, dass nicht einmal das Gegenteil stimmt. Selfcode: fo:) ch:{ rl:| br:< n4:( ie:| mo:| va:) de:] zu:) fl:{ ss:) ls:µ js:(