{"id":32339,"date":"2024-11-25T13:28:44","date_gmt":"2024-11-25T05:28:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32339\/"},"modified":"2024-11-25T13:28:44","modified_gmt":"2024-11-25T05:28:44","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%ae%9e%e4%be%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e6%a0%b9%e6%8d%ae%e7%bb%8f%e7%ba%ac%e5%ba%a6%e8%ae%a1%e7%ae%97%e4%b8%a4%e7%82%b9%e4%b9%8b%e9%97%b4%e7%9a%84%e8%b7%9d%e7%a6%bb","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32339\/","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5982\u4f55\u6839\u636e\u7ecf\u7eac\u5ea6\u8ba1\u7b97\u4e24\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\uff08\u4ee3\u7801\uff09"},"content":{"rendered":"<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5e26\u6765\u7684\u5185\u5bb9\u662f\u5173\u4e8e\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5982\u4f55\u6839\u636e\u7ecf\u7eac\u5ea6\u8ba1\u7b97\u4e24\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\uff08\u4ee3\u7801\uff09\uff0c\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<pre>\/\/\u8ba1\u7b97\u4e24\u70b9\u4f4d\u7f6e\u8ddd\u79bb\n&nbsp;&nbsp;getDistance:&nbsp;function&nbsp;(lat1,&nbsp;lng1,&nbsp;lat2,&nbsp;lng2)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nb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));&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;\/*\n&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(distance&nbsp;&amp;gt;&nbsp;1000){\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;distance&nbsp;=&nbsp;Math.round(distance&nbsp;\/&nbsp;1000);\n&nbsp;&nbsp;&nbsp;&nbsp;}*\/\n\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;distance;\n&nbsp;&nbsp;}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<p><\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5982\u4f55\u6839\u636e\u7ecf\u7eac\u5ea6\u8ba1\u7b97\u4e24\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\uff08\u4ee3\u7801\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5e26\u6765\u7684\u5185\u5bb9\u662f\u5173\u4e8e\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5982\u4f55\u6839\u636e\u7ecf\u7eac\u5ea6\u8ba1\u7b97\u4e24\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\uff08\u4ee3\u7801\uff09\uff0c\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002 \/\/\u8ba1\u7b97\u4e24\u70b9\u4f4d\u7f6e\u8ddd\u79bb &nbsp;&nbsp;getDistance:&nbsp;function&nbsp;(lat1,&nbsp;lng1,&nbsp;lat2,&nbsp;lng2)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;lat1&nbsp;=&nbsp;lat1&nbsp;||&nbsp;0; &nbsp;&nbsp;&nbsp;&nbsp;lng1&nbsp;=&nbsp;lng1&nbsp;||&nbsp;0; &nbsp;&nbsp;&nbsp;&nbsp;lat2&nbsp;=&nbsp;lat2&nbsp;||&nbsp;0; &nbsp;&nbsp;&nbsp;&nbsp;lng2&nbsp;=&nbsp;lng2&nbsp;||&nbsp;0;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;rad1&nbsp;=&nbsp;lat1&nbsp;*&nbsp;Math.PI&nbsp;\/&nbsp;180.0;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;rad2&nbsp;=&nbsp;lat2&nbsp;*&nbsp;Math.PI&nbsp;\/&nbsp;180.0;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;a&nbsp;=&nbsp;rad1&nbsp;&#8211;&nbsp;rad2;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;b&nbsp;=&nbsp;lng1&nbsp;*&nbsp;Math.PI&nbsp;\/&nbsp;180.0&nbsp;&#8211;&nbsp;lng2&nbsp;*&nbsp;Math.PI&nbsp;\/&nbsp;180.0;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;r&nbsp;=&nbsp;6378137;&nbsp;&nbsp;\/\/\u5730\u7403\u534a\u5f84 &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;distance&nbsp;=&nbsp;r&nbsp;*&nbsp;2&nbsp;*&nbsp;Math.asin(Math.sqrt(Math.pow(Math.sin(a&nbsp;\/&nbsp;2),&nbsp;2)&nbsp;+&nbsp;Math.cos(rad1)&nbsp;*&nbsp;Math.cos(rad2)&nbsp;*&nbsp;Math.pow(Math.sin(b&nbsp;\/&nbsp;2),&nbsp;2)));&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;\/* &nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(distance&nbsp;&amp;gt;&nbsp;1000){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;distance&nbsp;=&nbsp;Math.round(distance&nbsp;\/&nbsp;1000); &nbsp;&nbsp;&nbsp;&nbsp;}*\/ &nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;distance; &nbsp;&nbsp;} \u767b\u5f55\u540e\u590d\u5236 \u76f8\u5173\u63a8\u8350\uff1a \u4ee5\u4e0a\u5c31\u662f\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5982\u4f55\u6839\u636e\u7ecf\u7eac\u5ea6\u8ba1\u7b97\u4e24\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\uff08\u4ee3\u7801\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-32339","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=32339"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32339\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}