由于颶風(和其他災難)疏散計劃,以及它們通常如何作業/計劃,我正在嘗試開發一個涉及地理定位地址與疏散區的解決方案。
例如,通常情況下,在喬治亞州,員工會被告知居住在 I-95 以東的每個人都必須撤離(根據州政府的指導)。有時真的很糟糕,i-95 以東的每個人以及 i-95 以西的人都必須撤離。它本身并不重要,就好像它在 95 以西一樣,這是一場非常討厭的風暴,正朝著我們沖去,所有非必要人員都必須撤離,因此與 I-95 的距離,例如,事情,只是方向。
我已經在谷歌地圖檔案、谷歌搜索以及 StackOverflow 上尋找答案,但我什至沒有找到第一個指引我正確方向的面包屑。
非常感謝任何投入和花費的時間。如果沒有,我希望每個人都有一個美好的一周!
===
對于造成的混亂,我深表歉意。正如@Fraser 指出的那樣,地球上的每個點都在 I-95 的東/西,這是非常正確的,我匆忙中沒有考慮到這一點。話雖如此,它必須有某種邊界,比如東或西 100 英里對于這個用例就足夠了。
uj5u.com熱心網友回復:
這是一個非常簡單的解決方案,基本上你需要,
- 定義 I-95 的點,
例如
美國佛羅里達州北邁阿密 25.886999,-80.215033
美國佛羅里達州棕櫚灘縣 26.616067,-80.077996
...
巴爾米拉緬因州 04965,美國 44.845670,-69.339113
然后你將存盤這些點。在資料庫中或僅在代碼中,例如非常粗略的大約。I-95 路線是...
const I95 = [
[ 25.78364,-80.20397 ],
[ 25.87672,-80.20764 ],
[ 25.92758,-80.20947 ],
[ 25.96093,-80.16689 ],
[ 26.07565,-80.16895 ],
[ 26.20202,-80.14286 ],
[ 26.33871,-80.11540 ],
[ 26.41732,-80.08916 ],
[ 26.69125,-80.07053 ],
[ 26.80963,-80.09800 ],
[ 26.89172,-80.13457 ],
[ 27.05956,-80.24473 ],
[ 27.13447,-80.35813 ],
[ 27.26235,-80.42439 ],
[ 27.36947,-80.41054 ],
[ 27.39591,-80.39414 ],
[ 27.52203,-80.45045 ],
[ 27.65044,-80.52553 ],
[ 27.79038,-80.55236 ],
[ 28.17599,-80.71639 ],
[ 29.07689,-81.03222 ],
[ 29.42123,-81.16468 ],
[ 30.14514,-81.53397 ],
[ 30.35867,-81.66032 ],
[ 30.68282,-81.66581 ],
[ 30.96873,-81.68229 ],
[ 31.31721,-81.46740 ],
[ 31.86616,-81.35713 ],
[ 32.39924,-81.00667 ],
[ 32.97139,-80.67807 ],
[ 33.55893,-80.39473 ],
[ 34.24241,-79.78304 ],
[ 34.63655,-79.02817 ],
[ 35.01769,-78.82628 ],
[ 35.69044,-78.06967 ],
[ 36.17135,-77.78567 ],
[ 36.78059,-77.47569 ],
[ 37.44699,-77.34057 ],
[ 38.47267,-77.39426 ],
[ 39.59907,-75.87815 ],
[ 40.40772,-74.46824 ],
[ 41.26384,-73.08396 ],
[ 41.47261,-71.75990 ],
[ 42.05443,-71.23805 ],
[ 42.50737,-71.09643 ],
[ 43.11185,-70.73388 ],
[ 44.72099,-69.49369 ],
[ 44.83018,-68.74662 ],
[ 46.12428,-68.05448 ]
];
- 對您的地址進行地理編碼以獲取緯度和經度。
例如艾倫赫斯特。喬治亞州 -[ 31.786663, -81.609701 ]
- 對于給定的地理編碼位置,您需要根據匹配的 I-95 坐標確定最近的緯度。在我的示例中,
[ 31.86616,-81.35713 ]您只需查看經地理編碼的經度是大于(東)還是小于(西)該緯度的 I-95 經度。
例如,as-81.609701比-81.35713 Allenhurst少 。佐治亞州位于 I-95 州際公路以西,在31.86616北部附近。
As noted you probably want some "upper bounds" on the test as every point on earth is BOTH East and West of I-95 if one travels far enough. Because if you travel due East or due West from any point you arrive back at that same point :)
You could also do all of this in a spatial DB like PostGIS, MySQL with spatial types, etc - in that case it would be simply a matter of querying the DB to get your "East", "West" result without having to implement your own solution.
Possibly just defining two "areas" or "shapes" that cover the "East" and "West" locations you are interested in. That way it is simply a case of asking "is this [ lat, lng ] 'inside' (in the bounds of) the East or West 'shape'"
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/313506.html
標籤:谷歌地图 google-maps-api-3 谷歌API 地理定位
上一篇:ACF谷歌地圖有時無法正確加載,拋出“未捕獲的參考錯誤:谷歌未定義”
下一篇:在兩個打開的活動之間來回移動資料
