English 中文(简体)
如何在中间点(纬度、经度)获得 2 或 3 个半径位置
原标题:How to get 2 or 3 radial location s middle point (Latitude, Longtitude)

I tried to use haversine i couldn t succeed Basically my problem is i have 3 map locations with their Lat and Long values. What i trying to do is getting this triangle s middle point.

照片是这样的

""https://i.stack.imgur.com/xkPEV.jpg" alt="在这里输入图像描述"/ >

I Have the locations of H, F and I points. i need to know question mark s location. 41.040035,28.984026 41.040868,28.985807 41.039136,28.984981

PHP, MYSQL or Objective C any of these languages are ok as an answer. Even suggestions are appreciated. Thanks.

最佳回答

我检查了这个例子:http://geomidpoint.com/example.html

并在PHP中写下一个函数,希望这有帮助...

[edit] 我忘了转换成弧度进行计算, 所以它给出了不同的输出, 所以现在应该是正常的...

   <?php

function middlepoint($lat1,$lon1,$lat2,$lon2,$lat3,$lon3){
    $w1=1095.75;$w2=730.5;$w3=365.25;$tw=$w1+$w2+$w3;   //weighting factors

    $x1=cos(floatval(deg2rad($lat1)))*cos(floatval(deg2rad($lon1)));$y1=cos(floatval(deg2rad($lat1)))*sin(floatval(deg2rad($lon1)));$z1=sin(floatval(deg2rad($lat1)));$x2=cos(floatval(deg2rad($lat2)))*cos(floatval(deg2rad($lon2)));$y2=cos(floatval(deg2rad($lat2)))*sin(floatval(deg2rad($lon2)));$z2=sin(floatval(deg2rad($lat2)));$x3=cos(floatval(deg2rad($lat3)))*cos(floatval(deg2rad($lon3)));$y3=cos(floatval(deg2rad($lat3)))*sin(floatval(deg2rad($lon3)));$z3=sin(floatval(deg2rad($lat3)));  //convert lat/long to cartesian (x,y,z) coordinates

    $x = ($x1*$w1+$x2*$w2+$x3*$w3)/$tw;$y=($y1*$w1+$y2*$w2+$y3*$w3)/$tw;$z=($z1*$w1+$z2*$w2+$z3*$w3)/$tw;   //Compute combined weighted cartesian coordinates

    $lon=atan2($y,$x);$hyp=sqrt(pow($x,2)+pow($y,2));$lat=atan2($z,$hyp);   //Convert cartesian coordinate to latitude and longitude for the midpoint

    $midpoint[0] = $lon * (180/pi());$midpoint[1] = $lat * (180/pi());  //Convert from radians to degrees

    return $midpoint;   //return an array(lat,lon);

}

$test = middlepoint(41.040035,28.984026,41.040868,28.985807,41.039136,28.984981);
print_r($test);

?>
问题回答

在你工作的规模上,将拉特/长坐标作为飞机坐标处理不会造成任何伤害,并使用欧几里德几何学的基本操作来确定三角形的中点等位置。

您也可能对< a href=>" barycentic坐标 。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签