Index: trunk/extensions/Maps/ParserFunctions/GeoFunctions/Maps_GeoFunctions.php |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | array( 'location', 'bearing', 'distance' ) |
193 | 193 | ); |
194 | 194 | $doCalculation = $parameters !== false; |
195 | | - |
| 195 | + |
196 | 196 | if ( $doCalculation ) { |
197 | 197 | $canGeocode = MapsMapper::geocoderIsAvailable(); |
198 | 198 | |
— | — | @@ -202,9 +202,7 @@ |
203 | 203 | } |
204 | 204 | |
205 | 205 | if ( $location ) { |
206 | | - // var_dump($location); |
207 | 206 | $destination = self::findDestination( $location, $parameters['bearing'], $parameters['distance'] ); |
208 | | - // var_dump($destination);exit; |
209 | 207 | $output = MapsCoordinateParser::formatCoordinates( $destination, $parameters['format'], $parameters['directional'] ); |
210 | 208 | } else { |
211 | 209 | global $egValidatorFatalLevel; |
— | — | @@ -278,17 +276,18 @@ |
279 | 277 | * @param float $distance The distance to travel in km. |
280 | 278 | * |
281 | 279 | * @return array The desitination coordinates, as non-directional floats in an array with lat and lon keys. |
282 | | - * |
283 | | - * FIXME: something here is going wrong - need to debug |
284 | 280 | */ |
285 | 281 | public static function findDestination( array $startingCoordinates, $bearing, $distance ) { |
286 | 282 | $startingCoordinates['lat'] = (float)$startingCoordinates['lat']; |
287 | 283 | $startingCoordinates['lon'] = (float)$startingCoordinates['lon']; |
| 284 | + |
288 | 285 | $angularDistance = $distance / Maps_EARTH_RADIUS; |
| 286 | + |
289 | 287 | $lat = asin( |
290 | 288 | sin( $startingCoordinates['lat'] ) * cos( $angularDistance ) + |
291 | 289 | cos( $startingCoordinates['lat'] ) * sin( $angularDistance ) * cos( $bearing ) |
292 | 290 | ); |
| 291 | + |
293 | 292 | return array( |
294 | 293 | 'lat' => $lat, |
295 | 294 | 'lon' => $startingCoordinates['lon'] + atan2( |
Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.'; |
35 | 35 | } |
36 | 36 | else { |
37 | | - define( 'Maps_VERSION', '0.6 a18' ); |
| 37 | + define( 'Maps_VERSION', '0.6 a19' ); |
38 | 38 | |
39 | 39 | // The different coordinate notations. |
40 | 40 | define( 'Maps_COORDS_FLOAT', 'float' ); |