CodehighlightingproducedbyActiproCodeHighlighter(freeware)
http://www.CodeHighlighter.com/

-->TypeTMyPoint=packedrecordX:double;Y:double;end;{*-----------" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

如何判斷一個指定的經緯度點是否落在一個多邊形

系統 1866 0

一、背景:

如何判斷一個指定的經緯度點是否落在一個多邊形區域內?

二、實現代碼(delphi)


<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> Type
TMyPoint
= packed record
X:double;
Y:double;
end ;

{ *------------------------------------------------------------------------------
判斷指定的經緯度坐標點是否落在指定的多邊形區域內
@paramALon指定點的經度
@paramALat指定點的緯度
@paramAPoints指定多邊形區域各個節點坐標
@returnTrue落在范圍內False不在范圍內
------------------------------------------------------------------------------*
}
function IsPtInPoly(ALon,ALat:double;APoints: array of TMyPoint):Boolean;
var
iSum,iCount,iIndex:Integer;
dLon1,dLon2,dLat1,dLat2,dLon:double;
begin
Result:
= False;
if (Length(APoints) < 3 ) then
begin
Result:
= False;
Exit;
end ;
iSum:
= 0 ;
iCount:
= Length(APoints);
for iIndex: = 0 to iCount - 1 do
begin
if (iIndex = iCount - 1 ) then
begin
dLon1:
= APoints[iIndex].X;
dLat1:
= APoints[iIndex].Y;
dLon2:
= APoints[ 0 ].X;
dLat2:
= APoints[ 0 ].Y;
end
else
begin
dLon1:
= APoints[iIndex].X;
dLat1:
= APoints[iIndex].Y;
dLon2:
= APoints[iIndex + 1 ].X;
dLat2:
= APoints[iIndex + 1 ].Y;
end ;
if ((ALat >= dLat1) and (ALat < dLat2)) or ((ALat >= dLat2) and (ALat < dLat1)) then
begin
if (abs(dLat1 - dLat2) > 0 ) then
begin
dLon:
= dLon1 - ((dLon1 - dLon2) * (dLat1 - ALat)) / (dLat1 - dLat2);
if (dLon < ALon) then
Inc(iSum);
end ;
end ;

end ;
if (iSum mod 2 <> 0 ) then
Result:
= True;
end ;

如何判斷一個指定的經緯度點是否落在一個多邊形區域內?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 潍坊市| 安国市| 通辽市| 新乡县| 商南县| 沐川县| 芷江| 怀仁县| 河北区| 肃北| 历史| 洪雅县| 修文县| 蒙城县| 南投市| 上高县| 兴安盟| 来凤县| 安国市| 乌拉特后旗| 夏津县| 安塞县| 邢台市| 恭城| 平罗县| 浙江省| 太仓市| 襄樊市| 衡阳市| 浦城县| 赤壁市| 涟源市| 德安县| 高碑店市| 中超| 明溪县| 科技| 永丰县| 台北市| 那坡县| 巴彦淖尔市|