0

i have implement a static map that show a route based on

routes[0]->overview_polyline

and i also have add the start and end markers

The problem is that is not always working and i assume that there is a problem with overview_polyline but i can not figure out

This is a working static map that show both markets and route

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

This route is not working

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

Its only displays the markers without the route

i have implement the code from here Google static maps with directions

Can any help me make this work, any help appreciated

ntan
  • 2,195
  • 7
  • 35
  • 56

1 Answers1

0

When I check the encoded polyline from the second example in the Interactive Polyline encoder utility

https://developers.google.com/maps/documentation/utilities/polylineutility

I can see that the route is located somewhere in the sea as shown in the screenshot

enter image description here

Can you post the original Directions API request that returns this encoded polyline, please?

xomena
  • 31,125
  • 6
  • 88
  • 117
  • Sorry for the delay but i had reached the max places quota and i could not reproduce the problem.Here is the request {origin: "Athens, Central Athens, Greece", destination: "Pireas, Piraeus, Greece", travelMode: "DRIVING"}.I hope this helps, feel free to ask more details. – ntan Jul 05 '17 at 09:27
  • thanks for your time.I found that the problem was on console.log.I printed out the static map url thought console.log and because of too many chars added 3dots ... and the path was not valid.Your answer helped me to search why enc path in in the sea and i found it – ntan Jul 05 '17 at 10:12