实现方案参考字自 https://blog.csdn.net/u011170540/article/details/52327796#comments_14569288
使用方法:
使用前记得吧key换成你自己的
这个是案列 将key换成你自己的就能直接运行了
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <style> html, body, #container { width: 100%; height: 100%; } #panel { position: fixed; background-color: white; max-height: 90%; overflow-y: auto; top: 10px; right: 10px; width: 280px; } #panel .amap-call { background-color: #009cf9; border-top-left-radius: 4px; border-top-right-radius: 4px; } #panel .amap-lib-driving { border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; overflow: hidden; } </style> <title>位置经纬度 + 获取驾车规划数据</title> <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/> <script src="https://webapi.amap.com/maps?v=2.0&key=这个换成你自己的key&plugin=AMap.Driving"></script> <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script> </head> <body> 路径规划地址 https://lbs.amap.com/api/jsapi-v2/example/driving-route/plan-route-according-to-lnglat <div id="container"></div> <div id="panel"></div> <script type="text/javascript"> var map = new AMap.Map("container", { center: [116.397559, 39.89621], zoom: 14 }); var drivingOption = { policy: AMap.DrivingPolicy.LEAST_TIME, // 其它policy参数请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingPolicy ferry: 1, // 是否可以使用轮渡 province: '京', // 车牌省份的汉字缩写 map: map, panel: 'panel' } // 构造路线导航类 var driving = new AMap.Driving(drivingOption) // 得到道路的起点和终点 lng 是起点 lat是终点 var pointData = [ {name:'马平高速',lng:[102.10704,36.510657],lat:[102.895131,36.315291]}, {name:'平西高速',lng:[102.107171,36.510741],lat:[101.890833,36.567500]}, {name:'扎倒高速',lng:[101.444947,36.658568],lat:[100.977312,36.395115]}, {name:'倒恰高速',lng:[100.975721,36.394683],lat:[100.601114,36.313371]}, {name:'共茶高速',lng:[100.621104,36.310155],lat:[99.024610,36.791633]}, {name:'茶格高速',lng:[99.02461,36.791633],lat:[95.241182,36.320357]}, {name:'国道227线',lng:[101.400337,37.338018],lat:[101.409635,37.355061]}, {name:'湟西一级路',lng:[101.255312,36.678519],lat:[100.912481,36.948577]}, {name:'天峻至木里二级公路',lng:[99.005758,37.302956],lat:[99.185007,38.14385]}, {name:'宁大高速',lng:[101.769648,36.675237],lat:[101.671221,36.955074]}, {name:'平阿高速',lng:[102.06677,36.514797],lat:[101.998039,36.166782]}, {name:'阿李路',lng:[101.998091,36.166813],lat:[102.049911,35.955443]}, {name:'牙同高速',lng:[102.049911,35.955443],lat:[102.050715,35.601698]}, {name:'宁克大一级路',lng:[101.918869,37.293226],lat:[101.710829,36.920182]}, {name:'南绕城高速',lng:[102.030437,36.525563],lat:[101.45082,36.654742]}, {name:'察德高速',lng:[99.064747,36.803242],lat:[97.237958,37.337164]}, {name:'德小高速',lng:[97.232901,37.338839],lat:[95.456421,37.443962]}, {name:'共玉高速',lng:[100.554768,36.315336],lat:[97.110416,33.004556]}, {name:'德香高速',lng:[97.361811,37.152157],lat:[97.811951,36.013554]}, {name:'香花高速',lng:[97.811951,36.013554],lat:[98.968498,35.178302]}, {name:'花大久高速',lng:[98.968139,35.178483],lat:[101.456022,33.432397]}, {name:'当大高速',lng:[94.558678,38.346907],lat:[95.373641,37.83404]}, {name:'大察高速',lng:[95.373641,37.834041],lat:[95.450061,37.082692]}, {name:'察格高速',lng:[95.450061,37.082692],lat:[94.832594,36.339441]}, {name:'西塔高速',lng:[101.734966,36.588456],lat:[101.618095,36.485605]}, {name:'湟贵一级路',lng:[101.619537,36.478311],lat:[101.522191,36.116085]}, {name:'川大高速',lng:[102.800033,36.316571],lat:[102.797771,35.878431]}, {name:'民小一级',lng:[102.795955,36.321741],lat:[101.907382,36.563043]}, {name:'大循隆高速',lng:[102.093401,35.84197],lat: [102.783404,35.572171]}, {name:'西互一级',lng:[101.857626,36.580889],lat:[101.913712,36.762267]}, ] // 这个是特殊处理的道路 因为路径规划的不对,最后手动调整的 let gongcha = [99.024566,36.791458,99.03076,36.79158,99.030786,36.79158,99.032279,36.791641,99.032921,36.791684,99.035334,36.791914,99.035985,36.792014,99.036997,36.792201,99.039175,36.79263,99.039175,36.79263,99.040304,36.792847,99.041237,36.793034,99.041441,36.793064,99.041589,36.793073,99.041758,36.793064,99.041897,36.793034,99.04201,36.792995,99.042105,36.792947,99.042209,36.792878,99.042331,36.792756,99.042674,36.792391,99.04283,36.792257,99.042951,36.79217,99.043099,36.792096,99.043242,36.79204,99.043385,36.79201,99.043555,36.791988,99.043741,36.791988,99.04388,36.791997,99.044032,36.792036,99.044167,36.792079,99.044301,36.792148,99.045052,36.792674,99.045221,36.792778,99.045417,36.792869,99.045634,36.792943,99.045859,36.792995,99.04612,36.793038,99.04625,36.793043,99.046523,36.793021,99.046962,36.792973,99.047361,36.792917,99.047765,36.792895,99.047986,36.792899,99.047986,36.792899,99.048142,36.792895,99.048832,36.792943,99.049362,36.793012,99.049566,36.79303,99.049774,36.793016,99.049991,36.792986,99.050247,36.792925,99.050516,36.792847,99.050768,36.792747,99.050968,36.792652,99.051176,36.79253,99.051819,36.792105,99.05204,36.791949,99.05217,36.791957,99.052734,36.791962,99.053016,36.791966,99.063129,36.79214,99.066302,36.792196,99.06674,36.792209,99.066832,36.792209,99.06878,36.79224,99.06921,36.792244,99.069345,36.792253,99.069718,36.792257,99.0702,36.792253,99.07023,36.792235,99.070616,36.792231,99.070998,36.792218,99.071641,36.792174,99.072183,36.79214,99.072817,36.792083,99.073346,36.792031,99.074045,36.79194,99.074531,36.791871,99.074705,36.791845,99.075117,36.79178,99.076128,36.791623,99.076515,36.791571,99.076892,36.79151,99.077539,36.791406,99.079488,36.791107,99.080616,36.79092,99.08138,36.790812,99.081888,36.790734,99.082461,36.790642,99.083186,36.790534,99.083958,36.790412,99.084865,36.790269,99.085638,36.790143,99.086033,36.790082,99.086419,36.790017,99.086966,36.789926,99.087708,36.789813,99.088633,36.789674,99.090898,36.789327,99.092622,36.789058,99.092691,36.789071,99.093273,36.788967,99.09533,36.788641,99.095998,36.788537,99.09625,36.788494,99.09668,36.788424,99.09694,36.78839,99.098945,36.788077,99.101931,36.787609,99.104123,36.787266,99.104948,36.787122,99.105534,36.78704,99.107079,36.786801,99.110781,36.786228,99.111875,36.786055,99.112066,36.786016,99.112066,36.786016,99.112188,36.78605,99.113837,36.787001,99.113915,36.787036,99.114657,36.787465,99.114905,36.787595,99.115148,36.787708,99.115417,36.787808,99.115621,36.787869,99.115924,36.787938,99.116237,36.787986,99.116549,36.787995,99.116875,36.787982,99.117487,36.787895,99.117973,36.787778,99.118142,36.787717,99.11849,36.787552,99.118555,36.78753,99.118641,36.787513,99.11865,36.787509,99.119735,36.786797,99.120738,36.786124,99.121723,36.785473,99.12253,36.784991,99.123494,36.78447,99.125022,36.783685,99.126289,36.78306,99.127943,36.782227,99.131042,36.780664,99.139484,36.776419,99.139549,36.776389,99.140625,36.775842,99.148325,36.771984,99.149787,36.771237,99.162595,36.764792,99.17158,36.760252,99.18457,36.753711,99.191788,36.750069,99.193377,36.749266,99.201593,36.745113,99.206541,36.74263,99.215161,36.738281,99.217253,36.737227,99.219379,36.73615,99.224288,36.733689,99.225091,36.733268,99.22737,36.731997,99.228181,36.731519,99.228516,36.731315,99.229614,36.730634,99.234714,36.727292,99.236649,36.726033,99.238164,36.725065,99.239891,36.724084,99.241254,36.723359,99.242956,36.722539,99.24408,36.722031,99.245113,36.721602,99.246762,36.720959,99.250486,36.719575,99.251189,36.719314,99.258767,36.71648,99.259223,36.716306,99.26276,36.715009,99.267014,36.71342,99.268355,36.712934,99.269271,36.712626,99.270955,36.712105,99.272062,36.711801,99.272461,36.711693,99.273303,36.711484,99.274449,36.711233,99.275781,36.710964,99.277088,36.710729,99.277786,36.710616,99.278885,36.710447,99.279501,36.710378,99.281753,36.710161,99.283155,36.710061,99.290356,36.709774,99.294431,36.709596,99.299431,36.709375,99.300304,36.709327,99.301302,36.70921,99.302227,36.709049,99.302622,36.708958,99.303394,36.70875,99.304184,36.708494,99.304618,36.708342,99.305473,36.707986,99.306337,36.707569,99.307044,36.707161,99.307726,36.706706,99.308429,36.706168,99.308685,36.705955,99.309258,36.705434,99.309366,36.705321,99.309596,36.705078,99.309918,36.704718,99.310273,36.704288,99.310642,36.703772,99.310951,36.703303,99.311285,36.702687,99.311615,36.702031,99.314809,36.695161,99.315191,36.694336,99.316406,36.691727,99.31684,36.69079,99.317283,36.689887,99.317639,36.689227,99.318446,36.687821,99.319002,36.686953,99.319705,36.685916,99.320208,36.685208,99.320629,36.684644,99.321059,36.684106,99.321597,36.683459,99.321693,36.683346,99.32237,36.682569,99.322938,36.681957,99.332127,36.672361,99.335855,36.668459,99.337517,36.666723,99.338377,36.665833,99.339744,36.664401,99.340781,36.663342,99.342461,36.661793,99.342938,36.661376,99.343325,36.661042,99.344284,36.660286,99.345477,36.659384,99.348151,36.657452,99.348681,36.657109,99.354562,36.652852,99.355842,36.65194,99.356788,36.651359,99.357674,36.650898,99.358681,36.650438,99.358798,36.650391,99.359523,36.6501,99.35997,36.649944,99.360352,36.649826,99.361276,36.649544,99.366823,36.648043,99.367504,36.64786,99.36819,36.647674,99.370447,36.647053,99.371701,36.646667,99.3727,36.646428,99.3727,36.646428,99.374145,36.646089,99.374705,36.645929,99.376493,36.645451,99.377426,36.645165,99.379648,36.644557,99.382322,36.643832,99.383615,36.64349,99.386936,36.642574,99.397183,36.639792,99.398607,36.639401,99.404297,36.637843,99.408129,36.636797,99.422813,36.632773,99.426267,36.631823,99.430751,36.630573,99.432635,36.629961,99.43388,36.62951,99.435048,36.629054,99.436549,36.628416,99.438429,36.627604,99.448242,36.623351,99.452131,36.621662,99.452131,36.621662,99.454609,36.620577,99.460169,36.618181,99.461892,36.617431,99.470213,36.613815,99.47049,36.613689,99.472287,36.612882,99.473937,36.612049,99.475095,36.611415,99.475807,36.611003,99.477092,36.610221,99.47799,36.609631,99.479284,36.608737,99.480382,36.607904,99.480382,36.607904,99.480959,36.60747,99.482148,36.606445,99.483034,36.605681,99.487444,36.601272,99.492188,36.596454,99.493168,36.595456,99.501354,36.587144,99.503989,36.58447,99.505221,36.58322,99.510295,36.578064,99.511749,36.576567,99.514158,36.574141,99.514809,36.573485,99.51697,36.571289,99.523342,36.564792,99.523984,36.564162,99.524727,36.563472,99.52513,36.563129,99.525781,36.5626,99.525916,36.5625,99.526541,36.562053,99.527365,36.561493,99.527773,36.561241,99.528589,36.560777,99.529705,36.560195,99.53053,36.559809,99.531545,36.559397,99.532804,36.558945,99.533659,36.558676,99.534162,36.558537,99.534883,36.558364,99.535786,36.558164,99.536133,36.558099,99.536853,36.557969,99.537552,36.557869,99.538281,36.557778,99.539219,36.557695,99.547708,36.557105,99.558103,36.556411,99.574805,36.555278,99.580078,36.554931,99.585525,36.554566,99.588859,36.554362,99.592791,36.554076,99.592834,36.554071,99.593932,36.553997,99.594931,36.553898,99.595885,36.553776,99.596758,36.553624,99.597617,36.553459,99.598524,36.553238,99.599154,36.553073,99.6002,36.552756,99.601645,36.552248,99.602049,36.552096,99.603615,36.55151,99.609505,36.549332,99.612773,36.548129,99.612773,36.548129,99.624023,36.543984,99.626003,36.543268,99.626194,36.543199,99.627036,36.542882,99.629848,36.54184,99.630755,36.541489,99.631697,36.541102,99.63296,36.540573,99.633064,36.540525,99.634497,36.539887,99.636554,36.538932,99.63819,36.538112,99.645994,36.534028,99.654605,36.52954,99.655278,36.529184,99.667969,36.522565,99.672995,36.519944,99.67398,36.519405,99.675417,36.518555,99.675547,36.518477,99.67704,36.517539,99.677717,36.517079,99.679002,36.516163,99.681463,36.514319,99.684032,36.512365,99.685365,36.511376,99.685707,36.511098,99.686189,36.510751,99.689939,36.507917,99.690399,36.507565,99.693924,36.504909,99.695312,36.50385,99.696784,36.502765,99.697695,36.502122,99.698129,36.501836,99.699609,36.500903,99.700716,36.500256,99.701576,36.499787,99.703056,36.499019,99.704883,36.498177,99.708711,36.49658,99.711914,36.495247,99.715256,36.493854,99.71599,36.493537,99.716727,36.493194,99.717786,36.492691,99.718976,36.492096,99.719835,36.491645,99.721259,36.490846,99.722201,36.490291,99.723707,36.489353,99.724701,36.488698,99.726345,36.487517,99.728902,36.485595,99.729284,36.485299,99.73092,36.484054,99.730951,36.484028,99.733437,36.482127,99.733885,36.481801,99.734154,36.481602,99.734957,36.481055,99.735751,36.480569,99.736758,36.480013,99.737478,36.479648,99.738108,36.479362,99.738594,36.479145,99.739188,36.478911,99.740326,36.478498,99.741003,36.478273,99.751428,36.474978,99.7526,36.474609,99.755859,36.473576,99.759093,36.472565,99.760764,36.472018,99.761454,36.47178,99.762274,36.471458,99.763194,36.47105,99.764219,36.470534,99.765061,36.470065,99.765812,36.469596,99.766458,36.469145,99.766931,36.468793,99.767691,36.468186,99.768377,36.467595,99.772878,36.46362,99.774553,36.462144,99.775039,36.461727,99.775742,36.461159,99.776428,36.460651,99.77783,36.459753,99.778872,36.459093,99.780538,36.458273,99.782018,36.457665,99.782574,36.457474,99.783016,36.457335,99.784258,36.456953,99.786194,36.456454,99.787248,36.456181,99.799805,36.452947,99.801024,36.452635,99.80168,36.45247,99.804813,36.451649,99.814188,36.449232,99.814948,36.449062,99.816181,36.448724,99.821775,36.447287,99.822192,36.447179,99.82451,36.446567,99.831124,36.444865,99.835412,36.443746,99.836185,36.443555,99.836988,36.443381,99.837396,36.443312,99.837817,36.443264,99.838294,36.443225,99.838659,36.443207,99.839536,36.443225,99.840412,36.443307,99.840842,36.443377,99.84148,36.443511,99.842365,36.44375,99.84375,36.444154,99.844002,36.444232,99.854175,36.447174,99.854961,36.4474,99.85556,36.447548,99.857214,36.447921,99.858038,36.448064,99.859718,36.448229,99.860577,36.448294,99.861688,36.448333,99.862739,36.448329,99.863316,36.448307,99.864727,36.448203,99.86572,36.448086,99.866063,36.448038,99.867114,36.44786,99.868194,36.447635,99.872057,36.446706,99.874731,36.446042,99.876224,36.445686,99.887695,36.442878,99.890816,36.442122,99.892756,36.441649,99.893885,36.441367,99.896372,36.440768,99.909666,36.437535,99.91724,36.435699,99.91862,36.435365,99.920516,36.434918,99.921988,36.434631,99.923529,36.434418,99.924809,36.434297,99.925508,36.434262,99.92701,36.434249,99.928147,36.434288,99.928937,36.434358,99.930516,36.434523,99.931641,36.434679,99.932582,36.434813,99.951415,36.437474,99.952995,36.437682,99.953112,36.4377,99.953611,36.43776,99.954505,36.437843,99.956285,36.437986,99.957096,36.438025,99.958641,36.438077,99.959427,36.438086,99.960326,36.438077,99.961584,36.438043,99.964097,36.437899,99.965343,36.437791,99.967205,36.437565,99.969019,36.437287,99.970503,36.437018,99.971224,36.436879,99.972365,36.436615,99.97474,36.435972,99.975586,36.435716,99.975751,36.435668,99.981233,36.434063,99.982396,36.433702,99.98293,36.433559,99.987174,36.432318,99.988494,36.431931,99.989618,36.431602,99.990525,36.431337,99.992843,36.430664,99.996606,36.429566,99.997556,36.429314,99.998919,36.428963,100.001441,36.428377,100.003255,36.427995,100.005629,36.427556,100.019531,36.425187,100.032756,36.422921,100.034588,36.422604,100.035755,36.422378,100.037591,36.421966,100.038555,36.42174,100.039392,36.421528,100.041402,36.420964,100.041502,36.420929,100.043025,36.42046,100.04421,36.420061,100.045273,36.419674,100.045872,36.419449,100.047509,36.418806,100.048498,36.418381,100.052695,36.416562,100.063477,36.411875,100.0652,36.411124,100.066849,36.410395,100.070777,36.408689,100.074345,36.407135,100.077552,36.405742,100.078168,36.40549,100.079293,36.405043,100.080408,36.404622,100.081636,36.404188,100.083056,36.403728,100.084605,36.403251,100.085447,36.403021,100.086341,36.402782,100.095477,36.400521,100.098455,36.399796,100.099158,36.399609,100.106884,36.397704,100.107422,36.397569,100.109167,36.397135,100.110951,36.396667,100.112782,36.396115,100.114249,36.395616,100.115143,36.395282,100.116189,36.394874,100.117296,36.39441,100.118568,36.393845,100.126645,36.389948,100.127253,36.38964,100.129392,36.388615,100.133355,36.386723,100.133368,36.386719,100.134423,36.386189,100.137036,36.384926,100.138264,36.384345,100.139171,36.383937,100.140213,36.383503,100.141254,36.383095,100.142604,36.382613,100.144102,36.382127,100.145352,36.381766,100.147144,36.381319,100.14783,36.381163,100.148633,36.381007,100.150556,36.380673,100.151302,36.380564,100.151367,36.380551,100.152817,36.380378,100.155369,36.380122,100.155369,36.380122,100.161037,36.379553,100.161115,36.379544,100.164358,36.379227,100.165703,36.379071,100.166502,36.37895,100.167487,36.378776,100.16839,36.378572,100.169614,36.378251,100.170317,36.378038,100.171345,36.377678,100.171979,36.377435,100.172852,36.377066,100.173338,36.37684,100.173785,36.376628,100.174206,36.376406,100.174696,36.376133,100.175378,36.375729,100.175634,36.375582,100.176332,36.375135,100.177448,36.374353,100.180382,36.372161,100.181385,36.371445,100.182279,36.370855,100.182778,36.370556,100.183507,36.370152,100.184119,36.369831,100.185009,36.369418,100.185911,36.369036,100.193385,36.366172,100.194822,36.365647,100.195191,36.365521,100.195312,36.365486,100.195959,36.365304,100.196771,36.365109,100.196905,36.365082,100.196905,36.365082,100.197548,36.364957,100.198268,36.364852,100.198989,36.364774,100.199484,36.364744,100.199566,36.36474,100.200747,36.364718,100.201254,36.364735,100.201437,36.364744,100.202105,36.364792,100.202617,36.364844,100.203668,36.365009,100.208572,36.365946,100.210104,36.366202,100.211059,36.366328,100.211706,36.366389,100.21247,36.366445,100.213641,36.366493,100.214531,36.366493,100.215035,36.366476,100.21576,36.366441,100.216914,36.366341,100.217283,36.366298,100.217799,36.366246,100.223064,36.365556,100.227361,36.365,100.229036,36.364753,100.229102,36.364744,100.229909,36.364605,100.230764,36.364423,100.232192,36.364067,100.233355,36.363728,100.234466,36.363372,100.239258,36.361723,100.24457,36.359887,100.244952,36.359761,100.244952,36.359761,100.246319,36.35931,100.248524,36.358672,100.249878,36.358316,100.250938,36.358056,100.251016,36.358038,100.251437,36.357943,100.253837,36.357461,100.255156,36.357222,100.25602,36.357083,100.257799,36.356836,100.261228,36.356445,100.269753,36.355469,100.269753,36.355469,100.280456,36.354245,100.28148,36.354149,100.282652,36.354054,100.283203,36.354019,100.284779,36.353928,100.285829,36.353885,100.28773,36.35385,100.294058,36.353763,100.294371,36.353759,100.30299,36.353633,100.305174,36.353611,100.314614,36.353472,100.317995,36.353429,100.319796,36.353394,100.321185,36.353325,100.322496,36.353216,100.32349,36.353108,100.324523,36.352964,100.326385,36.352648,100.327148,36.35247,100.328108,36.352231,100.32928,36.351905,100.330573,36.35151,100.331198,36.351293,100.33194,36.35102,100.333251,36.350495,100.334023,36.350165,100.334727,36.349835,100.335299,36.349553,100.337248,36.348533,100.342556,36.345699,100.347656,36.342986,100.348064,36.342773,100.349119,36.342222,100.349375,36.342096,100.349957,36.341827,100.350603,36.341554,100.351254,36.341302,100.352118,36.341011,100.352964,36.340781,100.353715,36.340599,100.354818,36.340382,100.35569,36.340256,100.356411,36.340182,100.357804,36.3401,100.361098,36.339987,100.362786,36.339926,100.365625,36.339813,100.366215,36.339774,100.36714,36.339666,100.367656,36.339583,100.36829,36.339462,100.368832,36.339336,100.369857,36.339036,100.370495,36.338819,100.371055,36.338585,100.371094,36.338572,100.371801,36.338238,100.372283,36.33799,100.372899,36.33763,100.373789,36.337036,100.376658,36.334848,100.378659,36.333307,100.379991,36.332339,100.380408,36.332066,100.380794,36.331832,100.380881,36.331784,100.381293,36.331567,100.38191,36.331254,100.382287,36.331089,100.382908,36.330825,100.383872,36.330482,100.38467,36.330252,100.385677,36.330009,100.393064,36.328481,100.404197,36.326159,100.415039,36.323889,100.421554,36.322526,100.422118,36.322405,100.424614,36.321905,100.427014,36.32148,100.429058,36.321176,100.431558,36.320851,100.432049,36.320799,100.43701,36.320278,100.450577,36.31885,100.45342,36.318572,100.455382,36.318338,100.458281,36.318034,100.458984,36.317956,100.460872,36.317747,100.462079,36.317639,100.464648,36.317348,100.475217,36.316215,100.480955,36.315612,100.484028,36.315291,100.486563,36.315109,100.488329,36.315022,100.489384,36.314987,100.490634,36.314974,100.492409,36.314978,100.493967,36.315009,100.495386,36.315069,100.496784,36.315161,100.498772,36.315317,100.500104,36.315447,100.501484,36.315608,100.50293,36.315777,100.518034,36.3176,100.521198,36.317986,100.52447,36.318411,100.5249,36.318464,100.526584,36.318637,100.531536,36.319227,100.532196,36.319306,100.533264,36.31944,100.534809,36.319614,100.536502,36.31977,100.537018,36.319813,100.538021,36.319874,100.53918,36.319935,100.539887,36.319952,100.541094,36.319957,100.541671,36.319939,100.54227,36.319909,100.544796,36.319722,100.546415,36.319549,100.546875,36.319488,100.547075,36.319462,100.54832,36.319271,100.550156,36.318937,100.552127,36.318524,100.553733,36.318212,100.558598,36.317231,100.559878,36.31697,100.559878,36.31697,100.562656,36.316411,100.564049,36.316137,100.566467,36.31566,100.568845,36.315169,100.56944,36.315052,100.573003,36.314362,100.573989,36.314201,100.575386,36.314006,100.576398,36.313915,100.577418,36.313841,100.578568,36.313789,100.579536,36.313776,100.580582,36.313793,100.581419,36.313824,100.589102,36.314271,100.590009,36.314306,100.59082,36.314314,100.592856,36.314275,100.594392,36.314184,100.59622,36.314028,100.596984,36.313937,100.598559,36.313702,100.600729,36.313329] let xihuyiji = [101.857622,36.580894,101.857669,36.580907,101.857969,36.580968,101.859379,36.581159,101.860964,36.581406,101.862834,36.581701,101.865234,36.582075,101.866571,36.582287,101.867365,36.582444,101.868264,36.582678,101.868841,36.582873,101.869427,36.583108,101.870286,36.583537,101.870842,36.583859,101.871254,36.584132,101.871558,36.584349,101.871706,36.58447,101.872444,36.585065,101.873832,36.58625,101.874674,36.586975,101.876263,36.588333,101.876732,36.588741,101.877904,36.589748,101.878207,36.590035,101.878698,36.590525,101.879049,36.590946,101.879527,36.591602,101.879878,36.592161,101.880061,36.592522,101.880634,36.593815,101.881311,36.595456,101.882574,36.598511,101.883116,36.599813,101.883837,36.601641,101.884049,36.602253,101.884232,36.602869,101.88447,36.603854,101.884605,36.604614,101.884679,36.605243,101.884683,36.605291,101.884731,36.605864,101.884757,36.606445,101.88477,36.606871,101.884735,36.610503,101.884748,36.612435,101.884748,36.612435,101.884709,36.612904,101.884674,36.616042,101.884657,36.617431,101.884588,36.62401,101.884605,36.625234,101.884653,36.62625,101.884748,36.627387,101.88487,36.628368,101.884878,36.628416,101.885082,36.629753,101.885378,36.631801,101.885477,36.632804,101.885538,36.633806,101.885564,36.634692,101.88556,36.635456,101.885543,36.636094,101.885516,36.636636,101.885516,36.636636,101.885482,36.63737,101.885456,36.638763,101.88546,36.639401,101.885473,36.639761,101.88553,36.64092,101.885616,36.641927,101.885751,36.64306,101.88605,36.644813,101.886406,36.646424,101.886675,36.647422,101.88697,36.648407,101.887205,36.649106,101.887418,36.64974,101.887674,36.650391,101.887891,36.650942,101.88829,36.651901,101.890278,36.656632,101.892257,36.661376,101.893351,36.663989,101.894431,36.666502,101.895187,36.668542,101.895621,36.669891,101.895868,36.670747,101.896159,36.671866,101.896276,36.672361,101.896306,36.672483,101.897023,36.676029,101.898485,36.683346,101.898555,36.683689,101.899023,36.685664,101.89944,36.687153,101.899783,36.688247,101.900247,36.689575,101.901667,36.693455,101.901866,36.694067,101.901944,36.694336,101.902157,36.695043,101.902348,36.695777,101.9025,36.696393,101.902756,36.697639,101.902921,36.698641,101.903056,36.699648,101.903121,36.700347,101.903225,36.70191,101.903238,36.702921,101.903234,36.703576,101.903234,36.703576,101.903225,36.703911,101.903155,36.705321,101.903142,36.705616,101.903112,36.706159,101.903043,36.707465,101.903003,36.708242,101.903003,36.708242,101.902899,36.7101,101.902574,36.716306,101.902543,36.716918,101.902387,36.719852,101.902396,36.720352,101.902413,36.720603,101.90253,36.721354,101.902661,36.721849,101.902839,36.722331,101.902938,36.722565,101.903173,36.723034,101.903446,36.723485,101.903598,36.723702,101.903937,36.724132,101.904162,36.724397,101.904922,36.725213,101.905252,36.725556,101.905977,36.726311,101.906367,36.726723,101.90691,36.727292,101.90918,36.729666,101.911766,36.732387,101.91546,36.736263,101.91582,36.736675,101.91599,36.736897,101.916372,36.737435,101.916645,36.737895,101.916827,36.738281,101.916866,36.738364,101.917231,36.739201,101.917873,36.740773,101.918381,36.741966,101.919006,36.743264,101.91924,36.743733,101.919562,36.74431,101.919883,36.744887,101.920425,36.745794,101.922426,36.748932,101.922626,36.749266,101.923016,36.749926,101.923607,36.751003,101.924019,36.751819,101.924679,36.753247,101.925117,36.754323,101.925425,36.755174,101.925872,36.756523,101.926246,36.757886,101.926458,36.758707,101.926849,36.760252,101.927062,36.761107,101.927504,36.762587,101.927856,36.763681,101.928051,36.76421] let minxiao = [102.795946,36.321723,102.795707,36.321801,102.79457,36.322214,102.793876,36.322474,102.793876,36.322474,102.793798,36.322504,102.788086,36.324635,102.783225,36.326437,102.781484,36.327075,102.778585,36.328181,102.778016,36.328372,102.777682,36.328524,102.777253,36.328724,102.776892,36.328941,102.776289,36.329401,102.77582,36.329822,102.775599,36.330056,102.775291,36.33043,102.775022,36.330794,102.774926,36.330946,102.774497,36.331784,102.774436,36.331897,102.773802,36.333142,102.771089,36.338511,102.770612,36.339379,102.770447,36.339631,102.770247,36.339896,102.770017,36.340161,102.7698,36.340378,102.769514,36.340642,102.769201,36.340894,102.768537,36.341367,102.767899,36.341723,102.767513,36.341901,102.767109,36.342062,102.766697,36.342201,102.766111,36.34237,102.766059,36.342387,102.764605,36.342773,102.763338,36.343103,102.762912,36.343234,102.7623,36.343451,102.761784,36.343694,102.761476,36.343867,102.761163,36.344054,102.760864,36.344262,102.76056,36.344505,102.75964,36.345343,102.759366,36.345655,102.759193,36.345916,102.759015,36.346259,102.758971,36.346389,102.75895,36.346497,102.758932,36.346719,102.75888,36.34829,102.758854,36.348451,102.758811,36.348607,102.758585,36.349145,102.7574,36.351458,102.75714,36.351923,102.756884,36.352331,102.756649,36.352669,102.756402,36.352982,102.75592,36.35355,102.755738,36.353737,102.755707,36.353759,102.755603,36.353854,102.755412,36.353989,102.75523,36.354089,102.754857,36.354262,102.754423,36.354444,102.754123,36.35454,102.754123,36.35454,102.753919,36.354583,102.753598,36.354622,102.752999,36.35467,102.752752,36.35467,102.752496,36.354653,102.751918,36.354536,102.749883,36.354106,102.749635,36.354036,102.749353,36.353898,102.74924,36.353815,102.749175,36.353759,102.749102,36.353689,102.74875,36.35329,102.746532,36.350655,102.745968,36.350009,102.745807,36.349861,102.745608,36.349714,102.745378,36.349557,102.745135,36.349423,102.744909,36.349323,102.744666,36.349236,102.744158,36.349106,102.744141,36.349102,102.743898,36.349071,102.743563,36.349049,102.742891,36.349071,102.742439,36.349119,102.741467,36.349293,102.74105,36.349397,102.740634,36.349527,102.740178,36.349692,102.738438,36.350473,102.73819,36.350564,102.737891,36.350655,102.737626,36.350716,102.737235,36.350786,102.736654,36.350851,102.733559,36.351124,102.732513,36.351237,102.732122,36.351311,102.731628,36.351497,102.731376,36.351632,102.731172,36.351771,102.730981,36.351927,102.730829,36.352075,102.730668,36.352244,102.730547,36.352413,102.73046,36.352552,102.730373,36.352726,102.730304,36.352938,102.730256,36.353147,102.73023,36.353359,102.73023,36.353576,102.730239,36.353759,102.730304,36.354431,102.730308,36.354648,102.730291,36.354861,102.730256,36.355078,102.7302,36.355286,102.730139,36.355469,102.73003,36.355694,102.729913,36.355885,102.729744,36.35612,102.729579,36.356324,102.729301,36.356619,102.728824,36.357101,102.728559,36.357335,102.728186,36.357643,102.727669,36.358038,102.7273,36.358294,102.726832,36.358589,102.726298,36.358902,102.725799,36.359171,102.72523,36.359453,102.724961,36.359575,102.724592,36.359714,102.724219,36.359831,102.723772,36.359944,102.723073,36.360087,102.722166,36.360265,102.720508,36.360586,102.719414,36.360807,102.717535,36.361176,102.717214,36.36122,102.716918,36.361241,102.716636,36.361241,102.716263,36.36122,102.715977,36.361181,102.715521,36.361089,102.714618,36.360855,102.713815,36.360608,102.713563,36.360508,102.713286,36.360373,102.713043,36.360226,102.712708,36.359996,102.71112,36.358837,102.710747,36.358576,102.710464,36.358398,102.7102,36.35826,102.709944,36.358151,102.709657,36.358043,102.709327,36.35796,102.709049,36.357899,102.70875,36.35786,102.70839,36.357839,102.708051,36.357847,102.70375,36.358121,102.702209,36.358247,102.701957,36.358286,102.700929,36.35849,102.700677,36.358559,102.700391,36.358668,102.700195,36.35875,102.700069,36.358806,102.699492,36.359097,102.698503,36.359536,102.697956,36.359722,102.696089,36.360499,102.694271,36.36128,102.693728,36.361519,102.693273,36.36178,102.693073,36.361923,102.692921,36.362066,102.692773,36.362222,102.692617,36.362422,102.692513,36.362587,102.692426,36.362765,102.692313,36.363099,102.692287,36.363251,102.69227,36.363477,102.692279,36.363689,102.692309,36.36385,102.692405,36.364219,102.692635,36.364744,102.692969,36.365486,102.693051,36.365725,102.693095,36.365977,102.693073,36.366493,102.69309,36.366615,102.693116,36.36674,102.693286,36.367222,102.693316,36.367344,102.693333,36.367474,102.693316,36.367721,102.693082,36.369084,102.693064,36.369345,102.693064,36.369601,102.693086,36.369974,102.693173,36.370981,102.693316,36.372114,102.693468,36.372999,102.693681,36.373607,102.693746,36.373854,102.69375,36.374106,102.69372,36.374614,102.693741,36.374865,102.693928,36.375729,102.693954,36.375864,102.693993,36.37599,102.694041,36.376085,102.694128,36.376211,102.694301,36.376424,102.694514,36.376615,102.694627,36.376701,102.694753,36.376775,102.695321,36.376997,102.69559,36.377131,102.695968,36.377352,102.696181,36.377535,102.696267,36.377639,102.69678,36.378424,102.69691,36.37865,102.697018,36.378889,102.697053,36.379015,102.697166,36.379518,102.697166,36.379757,102.69714,36.379883,102.697092,36.38,102.696953,36.380226,102.696628,36.380642,102.696493,36.380877,102.696424,36.381115,102.696198,36.382109,102.696128,36.382357,102.695955,36.382839,102.695451,36.384045,102.695334,36.384423,102.695221,36.384926,102.6952,36.385299,102.695208,36.386458,102.695226,36.386719,102.695295,36.38697,102.695343,36.387088,102.695608,36.387552,102.695642,36.387691,102.695803,36.389392,102.695777,36.389549,102.695612,36.389913,102.695451,36.390152,102.69536,36.390252,102.695252,36.390343,102.695022,36.390521,102.694653,36.390751,102.694232,36.390933,102.692908,36.391328,102.691085,36.391693,102.690794,36.391775,102.690521,36.391888,102.690117,36.39207,102.68974,36.392279,102.689401,36.392526,102.688264,36.393411,102.687908,36.393689,102.687682,36.393845,102.687452,36.393976,102.686649,36.394349,102.686545,36.394418,102.686454,36.394501,102.686354,36.394618,102.68622,36.394835,102.685859,36.395473,102.685677,36.39576,102.685556,36.39592,102.685412,36.396068,102.685273,36.396181,102.685091,36.396302,102.684926,36.396389,102.684692,36.396484,102.684479,36.396549,102.684271,36.396589,102.684015,36.396619,102.683776,36.396632,102.683546,36.396615,102.682639,36.39645,102.682444,36.396428,102.682205,36.396419,102.681979,36.396432,102.681593,36.39651,102.681406,36.39658,102.681202,36.396684,102.681063,36.396771,102.68092,36.396884,102.680794,36.397005,102.68069,36.397144,102.680564,36.397344,102.680477,36.397522,102.680408,36.397704,102.679644,36.399839,102.679479,36.400226,102.679306,36.400577,102.678932,36.401202,102.678728,36.401484,102.678264,36.402049,102.67822,36.402092,102.67799,36.402322,102.677626,36.402669,102.675812,36.40428,102.675599,36.404453,102.67536,36.404614,102.6751,36.40477,102.674839,36.404896,102.674492,36.405048,102.674236,36.405139,102.671515,36.40589,102.67043,36.406233,102.669848,36.406419,102.669336,36.406549,102.669336,36.406549,102.668663,36.406667,102.668194,36.40668,102.667292,36.406658,102.665959,36.406571,102.665612,36.406558,102.665208,36.406589,102.664332,36.406797,102.664332,36.406797,102.664019,36.40691,102.663628,36.407127,102.662361,36.407921,102.661298,36.408689,102.660903,36.408967,102.66036,36.409358,102.65944,36.409896,102.658077,36.410516,102.657101,36.410938,102.656684,36.411115,102.65625,36.411267,102.65467,36.41184,102.654188,36.41201,102.651454,36.413082,102.650955,36.413273,102.648628,36.414171,102.646345,36.41503,102.643941,36.415942,102.642513,36.416389,102.64207,36.416558,102.641693,36.416649,102.640846,36.416806,102.640117,36.416927,102.639028,36.417053,102.636393,36.417313,102.635156,36.417422,102.634275,36.417504,102.627383,36.418099,102.626645,36.418164,102.625043,36.418268,102.624436,36.418312,102.621063,36.418698,102.620564,36.418776,102.620447,36.418785,102.618845,36.419028,102.618694,36.419063,102.616745,36.419505,102.616024,36.419674,102.61533,36.419844,102.613498,36.420391,102.612305,36.420812,102.610994,36.421276,102.610469,36.42148,102.609805,36.421736,102.607491,36.422648,102.606649,36.423003,102.603537,36.424306,102.603112,36.424466,102.602062,36.424766,102.597791,36.425716,102.596111,36.426042,102.595109,36.426233,102.59401,36.426445,102.590998,36.427135,102.590764,36.427201,102.59033,36.427313,102.588672,36.427739,102.585981,36.428533,102.584631,36.428989,102.583937,36.429227,102.582387,36.429874,102.582053,36.430013,102.580621,36.430664,102.580161,36.430872,102.579297,36.431354,102.578898,36.431576,102.578507,36.431788,102.577283,36.432465,102.572001,36.435872,102.568359,36.438294,102.565217,36.440382,102.564761,36.440673,102.564371,36.440929,102.563707,36.441276,102.562956,36.441567,102.56273,36.441649,102.562101,36.441875,102.561189,36.442161,102.561085,36.442179,102.560343,36.442305,102.558963,36.442478,102.55826,36.442509,102.557509,36.442509,102.556962,36.442474,102.556315,36.442452,102.554358,36.441905,102.553481,36.441649,102.552365,36.441319,102.550955,36.440855,102.549384,36.440334,102.549288,36.440304,102.548377,36.439974,102.548043,36.439874,102.547461,36.439692,102.546862,36.43954,102.546385,36.43947,102.546207,36.439444,102.546089,36.439423,102.545434,36.439397,102.544457,36.439453,102.543806,36.43954,102.542365,36.439865,102.541658,36.440104,102.541037,36.440447,102.540451,36.440907,102.54026,36.441124,102.540004,36.441389,102.539835,36.441649,102.538815,36.44322,102.538477,36.443763,102.537435,36.445773,102.535872,36.447943,102.535109,36.448806,102.534319,36.449501,102.533537,36.45013,102.533134,36.450378,102.532921,36.450477,102.529358,36.452118,102.527995,36.452635,102.525334,36.45365,102.525156,36.453724,102.524414,36.454154,102.524167,36.454293,102.520738,36.456302,102.519015,36.457166,102.518155,36.457504,102.516076,36.458155,102.51457,36.458472,102.510964,36.459093,102.508741,36.459531,102.508012,36.459644,102.507101,36.459813,102.506437,36.459948,102.505534,36.460074,102.50487,36.460122,102.502439,36.459896,102.501819,36.459844,102.498919,36.459583,102.484392,36.458264,102.481849,36.458138,102.481089,36.458099,102.480469,36.458021,102.479297,36.457878,102.478958,36.457821,102.47832,36.457752,102.477609,36.457765,102.477088,36.457817,102.476793,36.457878,102.476497,36.457969,102.476228,36.458073,102.475946,36.458255,102.475729,36.458472,102.475451,36.458824,102.475247,36.459145,102.475026,36.45957,102.474865,36.459983,102.474414,36.461341,102.47411,36.461957,102.473832,36.462357,102.473663,36.462591,102.473429,36.462826,102.473108,36.463043,102.4727,36.463225,102.472014,36.463516,102.47171,36.46362,102.470994,36.46388,102.467331,36.465178,102.466762,36.465382,102.465148,36.465951,102.461784,36.46714,102.461584,36.467231,102.460951,36.467517,102.458919,36.468655,102.458494,36.468941,102.457561,36.469575,102.456832,36.470074,102.456385,36.470391,102.454952,36.471437,102.454674,36.471615,102.453355,36.472461,102.452448,36.472956,102.452092,36.473168,102.450399,36.473898,102.448928,36.474514,102.448715,36.474609,102.44786,36.474965,102.446836,36.475369,102.441311,36.4775,102.439948,36.477951,102.439722,36.478012,102.439097,36.478112,102.43865,36.478147,102.438116,36.478164,102.436523,36.478168,102.435152,36.47816,102.434848,36.478151,102.433867,36.478147,102.43319,36.478151,102.432873,36.47816,102.43197,36.478238,102.431684,36.478277,102.429332,36.478594,102.426454,36.478976,102.426363,36.478984,102.425117,36.479149,102.421862,36.479674,102.41941,36.480191,102.416736,36.48089,102.415247,36.481328,102.414549,36.481584,102.412643,36.482283,102.408733,36.483876,102.407643,36.484323,102.406063,36.484835,102.40566,36.485117,102.404019,36.485582,102.403976,36.485595,102.40079,36.48635,102.398628,36.486697,102.397088,36.486931,102.394631,36.487296,102.394631,36.487296,102.392578,36.487574,102.377014,36.489692,102.375694,36.489887,102.371576,36.490599,102.370603,36.490699,102.36842,36.490924,102.367526,36.490959,102.366176,36.490985,102.364957,36.490964,102.364661,36.490959,102.361723,36.490786,102.356766,36.490382,102.352639,36.490117,102.35082,36.489983,102.350543,36.489965,102.34918,36.489944,102.348633,36.489991,102.346936,36.490139,102.344158,36.490469,102.343451,36.490508,102.342565,36.49049,102.339271,36.490165,102.336823,36.489926,102.333685,36.489674,102.333177,36.48974,102.332062,36.489874,102.328611,36.490391,102.328368,36.490425,102.328155,36.49046,102.326658,36.490712,102.326254,36.490781,102.325434,36.490985,102.324253,36.491133,102.323151,36.491207,102.322999,36.491207,102.322166,36.491211,102.321176,36.491146,102.317357,36.490851,102.316602,36.490777,102.315816,36.490694,102.314896,36.490599,102.313286,36.490369,102.311901,36.490139,102.311111,36.490039,102.3102,36.489896,102.309605,36.4898,102.307873,36.489575,102.306554,36.489449,102.306159,36.48941,102.305087,36.489366,102.304688,36.489349,102.302131,36.489245,102.295399,36.488945,102.294062,36.488776,102.293559,36.488646,102.289115,36.487365,102.288121,36.487057,102.287036,36.486845,102.285842,36.486758,102.285182,36.48671,102.284683,36.486727,102.283958,36.486758,102.283572,36.486775,102.282843,36.486918,102.282713,36.486944,102.281259,36.487231,102.279032,36.487786,102.278802,36.487812,102.278281,36.487873,102.276597,36.48806,102.275703,36.488086,102.274067,36.487895,102.272635,36.487556,102.271194,36.487023,102.268364,36.485777,102.267934,36.485595,102.264405,36.484093,102.262426,36.483355,102.261975,36.483181,102.261497,36.483038,102.260742,36.482821,102.258754,36.48224,102.255946,36.481515,102.255946,36.481515,102.254844,36.481198,102.254427,36.481098,102.253455,36.480855,102.252357,36.480625,102.251819,36.480521,102.251406,36.480443,102.251406,36.480443,102.251267,36.480417,102.250655,36.480386,102.24934,36.480399,102.243754,36.480794,102.238767,36.481293,102.233672,36.481797,102.232244,36.481931,102.231376,36.482044,102.230694,36.482166,102.23033,36.482253,102.229961,36.48237,102.229362,36.482639,102.228694,36.482999,102.22783,36.483663,102.227418,36.484071,102.227192,36.484366,102.226567,36.485061,102.226141,36.485595,102.224562,36.487539,102.223429,36.488867,102.223008,36.489253,102.222587,36.489536,102.222118,36.489796,102.221602,36.490017,102.221081,36.490213,102.220573,36.490352,102.219505,36.490503,102.218802,36.490625,102.217253,36.490951,102.216797,36.491133,102.216719,36.491168,102.215664,36.491619,102.215213,36.491866,102.214848,36.492122,102.214405,36.492513,102.213607,36.493338,102.212457,36.494405,102.211879,36.495009,102.211415,36.495378,102.210964,36.495664,102.21076,36.495742,102.210608,36.495803,102.210126,36.495942,102.209709,36.496029,102.207344,36.496285,102.206094,36.496398,102.206094,36.496398,102.204023,36.49658,102.203672,36.49661,102.202943,36.496675,102.201393,36.496758,102.200686,36.496714,102.20003,36.496602,102.199952,36.49658,102.199397,36.496428,102.197088,36.495647,102.195686,36.495139,102.194822,36.494852,102.194058,36.494605,102.190964,36.493472,102.190434,36.493351,102.188885,36.49322,102.187995,36.493238,102.187018,36.493377,102.186589,36.493464,102.186363,36.493529,102.186363,36.493529,102.18622,36.493572,102.185799,36.493737,102.184601,36.494375,102.183863,36.494844,102.182235,36.495951,102.181319,36.49658,102.180937,36.496849,102.180868,36.496897,102.180356,36.497261,102.180152,36.497391,102.178976,36.498121,102.177973,36.498655,102.177318,36.498976,102.176727,36.49924,102.176063,36.49947,102.175473,36.499635,102.174753,36.4998,102.173971,36.499918,102.173125,36.499996,102.172852,36.500022,102.171046,36.5002,102.169605,36.500291,102.169149,36.500326,102.168867,36.500369,102.168433,36.500451,102.167882,36.500608,102.167409,36.500803,102.166853,36.501146,102.166549,36.501354,102.166337,36.501536,102.166094,36.501793,102.165859,36.502079,102.165464,36.502721,102.165056,36.503316,102.164236,36.504575,102.163867,36.504996,102.163194,36.505577,102.162695,36.505846,102.162205,36.506068,102.161966,36.50615,102.15691,36.507565,102.155725,36.507908,102.154145,36.508372,102.152652,36.508746,102.151997,36.508828,102.151554,36.508872,102.151007,36.508885,102.150877,36.50888,102.150425,36.508859,102.148082,36.508668,102.146654,36.508589,102.145807,36.508602,102.145425,36.508633,102.144987,36.508689,102.144145,36.508841,102.143299,36.509106,102.142904,36.509249,102.142535,36.50944,102.141801,36.509809,102.141237,36.510122,102.134401,36.513828,102.134054,36.514023,102.13303,36.51457,102.132053,36.515126,102.131714,36.515295,102.131411,36.515473,102.131033,36.515647,102.129253,36.516541,102.128906,36.516684,102.128689,36.516775,102.128125,36.516992,102.127066,36.517292,102.126411,36.51747,102.124779,36.517799,102.123255,36.51806,102.121615,36.518312,102.12092,36.518455,102.120547,36.518555,102.117257,36.519653,102.117257,36.519653,102.114779,36.520334,102.112552,36.520829,102.106931,36.522057,102.099822,36.523611,102.099557,36.523655,102.099232,36.523659,102.098845,36.52365,102.097891,36.523572,102.097253,36.523459,102.096341,36.523264,102.096155,36.523225,102.095391,36.522995,102.094579,36.522704,102.093793,36.522383,102.092222,36.521649,102.091354,36.521267,102.0902,36.520807,102.087378,36.519874,102.084961,36.519106,102.084683,36.519019,102.08378,36.518819,102.083628,36.518798,102.083416,36.518793,102.080013,36.518859,102.079449,36.518828,102.078767,36.518919,102.078312,36.519032,102.077122,36.519444,102.076289,36.519627,102.076016,36.51964,102.074583,36.519501,102.069813,36.518971,102.069058,36.518928,102.068602,36.518924,102.066667,36.518958,102.064978,36.518976,102.063841,36.518989,102.062986,36.519002,102.060621,36.519041,102.059753,36.519041,102.058537,36.519019,102.057057,36.51895,102.056306,36.518919,102.055538,36.518876,102.053477,36.518785,102.052031,36.518694,102.049536,36.518585,102.048976,36.518568,102.048559,36.518555,102.047678,36.518516,102.047192,36.518524,102.046623,36.518516,102.046372,36.518542,102.046319,36.518555,102.045951,36.518624,102.044957,36.518889,102.042665,36.519475,102.042227,36.519627,102.041016,36.519957,102.039844,36.520286,102.03941,36.520382,102.038915,36.520451,102.03829,36.520503,102.036424,36.520608,102.035508,36.520634,102.035161,36.520681,102.034796,36.520773,102.031445,36.521753,102.030143,36.522153,102.028082,36.522708,102.026853,36.523134,102.026649,36.523203,102.026649,36.523203,102.026155,36.523368,102.025569,36.523546,102.024358,36.523924,102.024141,36.524062,102.022708,36.524497,102.021502,36.524839,102.019041,36.525595,102.018672,36.525716,102.017956,36.525946,102.015152,36.526927,102.012626,36.527795,102.012548,36.527817,102.011871,36.528047,102.010161,36.528611,102.009401,36.528854,102.008051,36.529245,102.006984,36.52954,102.004835,36.530135,102.004167,36.530334,102.003316,36.530586,102.002322,36.530881,102.001897,36.530994,102.001302,36.53115,102.000803,36.531302,101.999566,36.53184,101.99951,36.531866,101.998893,36.532153,101.997778,36.532656,101.99707,36.532969,101.996923,36.53303,101.996254,36.533268,101.995421,36.533529,101.99349,36.533915,101.990859,36.534457,101.989787,36.534727,101.988806,36.53503,101.987821,36.535425,101.986241,36.536181,101.983681,36.537565,101.983681,36.537565,101.983251,36.537799,101.98293,36.538021,101.98049,36.539505,101.979696,36.539996,101.978841,36.540525,101.97849,36.540738,101.977613,36.541289,101.975547,36.542548,101.975048,36.542852,101.973225,36.543958,101.972066,36.544722,101.971706,36.544987,101.97092,36.545668,101.970842,36.54576,101.970781,36.545825,101.969883,36.546814,101.969258,36.547413,101.968759,36.547752,101.968394,36.547956,101.967161,36.548377,101.966979,36.548481,101.966072,36.549184,101.965204,36.549844,101.963472,36.551237,101.963416,36.551276,101.963129,36.55151,101.961176,36.553099,101.960894,36.553368,101.960226,36.554102,101.959848,36.554475,101.959288,36.554931,101.958082,36.555786,101.956576,36.556849,101.956241,36.557105,101.955951,36.557348,101.955278,36.557925,101.954909,36.558286,101.954475,36.558741,101.954115,36.559154,101.953798,36.559549,101.953767,36.559592,101.953307,36.560213,101.953134,36.560404,101.953125,36.560417,101.952947,36.560582,101.952739,36.560751,101.952504,36.560898,101.952287,36.561016,101.952062,36.561115,101.951819,36.561198,101.951584,36.561259,101.951298,36.561311,101.950968,36.561345,101.950729,36.561354,101.950269,36.561319,101.949779,36.561241,101.946133,36.56056,101.941858,36.559787,101.941181,36.55974,101.940812,36.559744,101.940469,36.559766,101.940113,36.559822,101.939787,36.559896,101.939479,36.559983,101.939206,36.560082,101.938906,36.560208,101.938668,36.560334,101.93842,36.560486,101.938177,36.56066,101.937214,36.561432,101.93694,36.561623,101.936675,36.561788,101.936372,36.561957,101.93612,36.562075,101.935781,36.562196,101.935499,36.562287,101.934861,36.562426,101.934223,36.562491,101.933607,36.562483,101.933346,36.562461,101.932873,36.562374,101.932218,36.562196,101.931905,36.562083,101.931567,36.561927,101.93115,36.561688,101.931124,36.561671,101.930881,36.561502,101.930625,36.561285,101.929722,36.560438,101.929327,36.560082,101.929084,36.559891,101.928754,36.559661,101.928121,36.559275,101.927747,36.559093,101.927348,36.558919,101.926927,36.558772,101.926372,36.558602,101.925877,36.55849,101.925278,36.558398,101.924944,36.558372,101.924505,36.558364,101.924097,36.558364,101.923424,36.558424,101.92303,36.558494,101.92303,36.558494,101.922122,36.558468,101.921758,36.558481,101.921402,36.558516,101.921063,36.558581,101.920694,36.558676,101.92036,36.55878,101.919996,36.558902,101.916532,36.560421,101.914162,36.561532,101.913615,36.561758,101.912478,36.562101,101.910317,36.5625,101.90918,36.562708,101.908711,36.562791,101.907452,36.56303,101.907378,36.563034] var data = {}; pointData.forEach(point => { var promise = new Promise((resolve, reject) => { var name = point.name // 根据起终点经纬度规划驾车导航路线 driving.search(new AMap.LngLat(point.lng[0], point.lng[1]), new AMap.LngLat(point.lat[0], point.lat[1]), function (status, result) { if (result.routes.length > 0) { let steps = result.routes[0].steps let paths = [] if(name == '民小一级'){ paths = minxiao }else if(name == '西互一级'){ paths = xihuyiji }else if(name == '共茶高速'){ paths = gongcha }else { // debugger steps.forEach(step => { step.path.forEach(item => { paths.push(item.lng) paths.push(item.lat) }) }) } resolve({name: name, paths: paths}) } }); }); promise.then(res => { var result = [] // debugger for(var i=0;i<res.paths.length;i+=2){ if(i % 6 ==0){ result.push(res.paths.slice(i,i+2)); } } data[res.name] = result // data[res.name] = res.paths }) // 打开页面等页面渲染完成后在控制台输入 JSON.stringify(data) 就可以了 }) </script> </body> </html>
这个下面的代码是为了处理不正确的路径的手动修改 我最终的代码里也有注释 那个里面的数据就是通过这个方法得到的
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <title>可拖拽的路线规划</title> <style> html, body, #container { width: 100%; height: 100%; } </style> <script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=您申请的key值"></script> <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script> </head> <body> <div id="container"></div> <div id="tip">请拖拽路径试试</div> <script type="text/javascript"> var map, route, marker; //基本地图加载 map = new AMap.Map("container", { resizeEnable: true }); //绘制初始路径 var path = []; path.push([116.303843, 39.983412]); path.push([116.321354, 39.896436]); path.push([116.407012, 39.992093]); map.plugin("AMap.DragRoute", function() { route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类 route.search(); //查询导航路径并开启拖拽导航 // 这个是我加的 route.on('complete', (result) => { debugger console.log(result.data.routes[0].steps) // result.data.routes[0].steps 这个里面的 path 就是路线的坐标 // 在这里拿到路径返回的具体数据 }) }); </script> </body> </html>