-2

I couldn't able to show up the route directions between my markers on static map.

I have run through This and This and finalize my URL as below:

https://maps.googleapis.com/maps/api/staticmap?center=41.0933217,29.0924325&size=357x632&markers=color:red%7Clabel:1%7C41.0933217,29.0924325&markers=color:red%7Clabel:2%7C41.0928494,29.0964868&path=color:0xff0000ff|enc:ezxyFs_rpDyC[s@WI?UDa@l@YP{@PUD@JAb@Xd@DHGNKf@EX@JCRSHOFQCIVMTRJD^@FLCRlBPzBPDrAb@z@\\LBAHGlAMbC?`@?a@Du@N{C@IMC{@]sAc@QEQ{BSmBMBAGE_@SKVm@PBNGRIBSAS@IH]La@_@o@?o@dASXKVUTa@NEH?PBf@Rh@dALb@B`@&key=[KEY]

On the image, only markers could be seen. I have also checked my encoded polyline through Here. I copy and paste my polyline (which I get from https://maps.googleapis.com/maps/api/directions) on "Encoded Polyline" section on that page, and it successfully creates directions.

I can't figure out what I am missing.

Thank you in advance!

RaZzLe
  • 1,984
  • 3
  • 13
  • 24

1 Answers1

1

It seems that you have some incorrect values in your encoded polyline, I've recreated the Static Maps URL request below:

https://maps.googleapis.com/maps/api/staticmap?center=41.0933217,29.0924325&size=357x632&markers=color:red%7Clabel:1%7C41.0933217,29.0924325&markers=color:red%7Clabel:2%7C41.0928494,29.0964868&path=color:0xff0000ff|enc:{|xyFe|qpDHx@ZLvBz@nA`@`AXWvAAPONGDMBkB}@_B}@QEY?{E{BSOY[[g@WUUGa@Ea@DS@W?a@IoDw@oCc@qC[eEk@yCc@e@@Q`@GLETCXB\HXJPTNVF\?xBO`BCjCFtCRLADEj@b@p@z@fBjCj@|@VNJBr@Fn@VZ`@FHHZJ~@@r@OjAGv@GzB?dCEjBPLxAh@NBVCDAe@uEJ[Hi@RuD@c@`@Nf@TEd@GhAEdAC|@&key=YOUR_API_KEY

In order to prevent errors when creating encoded polyline, you may use the Directions Calculator then after you enter the desired locations, click "JSON" in the upper right then copy the encoded polyline under "overview_polyline" then include it on your Static Maps URL.

Shawn Domingo
  • 1,371
  • 1
  • 11
  • 16