JavaScript / Google Maps - 使用多个lat,long绘制路径

时间:2017-06-13 21:11:57

标签: google-maps google-maps-api-3

我在行程结束时跟踪驾驶员,生成包含所有坐标(纬度,长度)路线的数组。使用lat,long coords数组,我想使用Google Maps绘制路径,更具体地说是directionService。到目前为止,我没有成功,因为我发现的方法是使用航路点,但是航路点默认限制为15;但是,我还有更多。

我正在寻找一种如何使用多个coords绘制该路径的方法,存在多个应用程序,例如UBER,Lyft等......

这是一系列的坐标:

[35.77204705542798,-5.815865197320899,35.77205120747819,-5.815754188240848,35.77197468036722,-5.815810097181759,35.77201185726312,-5.816182008817898,35.77188028308802,-5.816782866625928,35.77144809183601,-5.817054836919457,35.77130127311978,-5.817231221149015,35.77121654704168,-5.817323279458099,35.77197602552531,-5.818491135420929,35.77211527443405,-5.818831898394636,35.77220613582161,-5.819054426882189,35.77225761824354,-5.819182167400329,35.77557809840525,-5.819685065789988,35.77522352494348,-5.821346612263469,35.77815743782872,-5.822735160242799,35.77863231735067,-5.822959942846667,35.77915215012052,-5.823206036666789,35.77917987363854,-5.82321907562955,35.77913908191616,-5.825751400638378,35.77947725976961,-5.826044519616627,35.77923063670355,-5.82893344672563,35.77920722271806,-5.829544463218058,35.77924325929096,-5.82965650991142,35.77913169320556,-5.830906964998152,35.77917349450947,-5.830173084585434,35.78563643141488,-5.829373128632887,35.7859055726137,-5.829317961099034,35.78659089504106,-5.829249272155759,35.78704770052305,-5.829163948962961,35.78696081760869,-5.829114610331397,35.78687737614365,-5.829067226012621,35.78679073445069,-5.829018024365507,35.78661289235281,-5.828929232334034,35.78652027010703,-5.828884857172518,35.78643576729606,-5.828844387274908,35.78635159916791,-5.828804167105649,35.7862672257822,-5.828763857888811,35.7872100444153,-5.866787159467321]

1 个答案:

答案 0 :(得分:0)

如果您想要绘制简单的线条,请参阅此链接。 https://developers.google.com/maps/documentation/javascript/examples/polyline-simple

与Direction服务不同,没有航路点限制。