我实现了一个静态地图,显示了基于
的路线routes[0]->overview_polyline
我还添加了开始和结束标记
问题是并不总是有效,我认为overview_polyline存在问题,但我无法弄清楚
这是一个显示市场和路线的工作静态地图
https://maps.googleapis.com/maps/api/staticmap?size=650x400&path=enc:q|wfFs}yoCuEhLyC`Gk@rI{@pLoF|LyEiAaHrE{VlPzAxNsAnK{Plc@gl@jbAon@|sAuN~b@uRr\}Rl\iIxWbCr}@fG`d@iJnp@{Ez]v@nhA~ItjAgGzn@}Ib[wQfAit@vAcf@rOig@h\wWpc@ie@~uAmF~aAtRrbAsLdVgZf_@_LjrAuEjp@^|_@n^fr@`_@pi@h\|Z|y@|`@rRhZ?~a@sGz\nLjiB~Yh`Cvr@vqBjc@`qAf^xoBvXfoAp|@bdBht@xwAhC~ZqAb^aGlt@fHbe@jp@rfAfE`a@oBna@cMlr@aXljATnx@xIbp@dA~r@_Ghm@jKds@`O~z@nAj|@tP`h@|nAvrCz]fw@hIx^nLzu@|Nz[jZjl@vh@ndAny@n_Btv@n}AQfl@{Rfm@wTl`@eQdv@Cni@nGjb@zL|k@~Afj@iCva@eJblDrE`n@`Mbe@eAxUiJxTHj\`Oh_@nRtcA?lWsJpq@wJfy@w@rt@pG|w@zGfh@`FfqCpSl{BnWvzAxLt{@tD~}@]`|@cGxj@}Ujy@_Uv^yUt|@oHdk@{^xbBap@jkB{\bu@gYd`@wd@`c@}_@`Wid@lR_b@rD}SfU{b@rXgh@p[wVw@giAZe\{BwNXq^xNm|@~^em@nd@uiAr{Au_@hrA}Zf}@g]p}@eKp^eBxd@wGrWcQjPwNbP{ElV}o@v}Bl@hh@cArn@cO`d@mNv^wBnU}Wtw@sM|[yAvTyKl^ae@|y@mM|k@aOb`@cGvd@{Wr}Agr@foAkk@p}@ij@pw@aZfr@^lm@hAzbAd\lkB{Krs@oMrXeNpj@}Jh`AbCpQfS`s@`Avj@_]``Cwh@rbA?hc@wTty@iSffAs]`n@{Xd\cg@zb@ai@lhAc@n_AyBlpAwCfx@~Frd@xNpb@y@~kAsFjZuYn_@uFp[v@fZcGjs@{F`j@cGdxAeXjyA{Kx{@}HjaAiAde@sOr[}IvzAe[`c@iNpNu[h^mM`ZmNlXgJfY{ZfeAwWzkA}h@rjAqt@j}Ak]j]qr@j\qk@dTg\`g@wNtJuWzUma@n~@iUpd@_Wz[iE~S{Gld@yEpMuRzIuVpNmp@nvAeYll@{_@vWuNtZaa@jq@oYv_@qf@tsA}Nli@mAlXeHd|@xHv^uAjx@lLl\|Bhf@iCli@xGpi@}If{@fFn[d@py@uFd|@vCftAq@h`@vBhb@tB`m@jUrj@rZ|WrOjb@rJji@rPte@h`@f|@dq@lwAjXtm@dY|^ti@|m@veAzbAb}@ri@fKxH_CtQ^f@bWzHlQfPrQzY&markers=color:green|label:A|37.9746479,23.73097699999994&markers=color:red|label:B|38.24670270000001,21.7345758000000162
这条路线不起作用
https://maps.googleapis.com/maps/api/staticmap?size=650x400&path=enc:q|wfFs…n@y@zHc@hCg@jCmASUnDUbDc@tGWzCEp@MxBSnBCRM?uDlCkA{AY_@[c@IHmAjA[^e@Z}At@aC`BeIvFu@^cBfA{GlEKF\fCb@lDXpBJhAE~@[rBMv@c@bDgAvIW~@aA~BKPcBjDoAbCsA~BeCrDeEnG}D~GmDdGeE~G}F~J{B~D}DzGUNUZ_A~AaHjLIXAf@Bf@H^^t@FR@PbDrDpDvEbAlAjAvApD`E~@`A`KrLX\v@|@vCjDr@t@`Av@rKxGnEpCfFjDtHdFbC~AhAn@lFdD~E~CpMjIzBtAn@b@lIpFlC~A\LnBp@j@JbAFrB?|Ba@bBm@vBkAdG}C`@WvBwAxAgAxAaAbAk@p@Wp@Mz@G^AdAHpCt@t@Vh@V|J`DlHbCpKnDbBd@lB^~Bd@rCr@|HzBzIhCfAXfAP`F^z@FbEVhDJnJFlGBjC@d@Ln@?ZHb@V^j@Jb@Fr@?bA?bGEpBAzNE|DPzK@zAAr@KfASx@a@z@mDbGyGfLeBzCs@~Am@fB{@bE_@|Bw@dJ]xENd@@l@FbBDz@DN`@P`Bx@lCtAlD~AdAd@vA|@vIhHvAdA^Vx@n@CH&markers=color:green|label:A|37.9746479,23.73097699999994&markers=color:red|label:B|37.9429712,23.646971099999973
它只显示没有路径的标记
我已经从这里实现了代码 Google static maps with directions
任何帮助我做这项工作,任何帮助赞赏
答案 0 :(得分:0)
当我从交互式折线编码器实用程序
中的第二个示例中检查编码折线时https://developers.google.com/maps/documentation/utilities/polylineutility
我可以看到路线位于海中某处,如屏幕截图所示
您可以发布返回此编码折线的原始Directions API请求吗?