1

I am making an application using mainly Python to find the most fuel efficient route using primarily Google Maps data. I have been using the Encoded Polyline Algorithm to get elevation data, as well as a small Python module for the conversions. Normally, the conversion from LatLngs into polyline works fine. However, this URL returns a 400 error:

https://maps.googleapis.com/maps/api/elevation/json?locations=enc:yf{{EreegNl{WqnW_pKl{gAzqHsuYb_Cedg@sln@r{n@vaIpcBnm]viUzrm@kd^aebA|n`@t_aAe{L}}BmzLynfAi}X~sa@ukh@~|WfwmBa}b@krlAnqc@q|CubJdxsAes`@ca_Bh`Rw}Ob_m@bivAy|k@vnDzq_@_zx@g`LxxkAkzu@mrhAvwl@v_jAipZol\\jb[ejfA~p[ndzAmrhAgm_@nkStrAj|BhjZwtj@uhl@bh@{zDxfq@l{z@qf^_igAjbt@e~FydLssQmpZlv~@jlVq|y@_{d@xk`@~cfAbyr@qsfAs}|@srAvk]kcEqf@x~j@n{Qi_q@_gY|khAptr@~o@grxA}`_A`u{@lgMolJhpl@qsj@mcUxaoAab_@eklAxj`@isDr`Gz`Fhra@xb`@{{T{zc@ihPbrvA{xBgmrBpl\\hxgB_yZc`gBsvIr`}At~FelzA`oElsBrzg@pmtAqaaAmlUvce@rhh@ndZy|X}~p@mos@yxRn{X`eeAr}Ywg|@y_ArlPgwCvfNwby@gaDnjzA}pEDieIcgVuiX{waA}yC~uTp|u@|saAjiSynv@}th@klq@`la@phu@srqAilHfqkAtax@qmmAcvp@npmA~no@y_YusTg_PaodAouIrdg@ttg@nqx@cwQipDt~`@wslAqtFc|AybVtmAo{Nv`s@qbQ_bUfy`A~il@{oMautAqyaAlhZfsl@fdf@xzEslcAsvn@xdo@`t{@iup@_{NdgdB_pa@k_Zp_h@||X}}t@idlA|az@irY_pGkbIrhC`puAgkI{eg@}mm@ej@xtyAzlq@yc_@{__A}t@q|Z_jNhlBd}IbrmAxFw{Cqu[vfLjmj@iflA_|j@jilAde`@rbPccg@{xvA~aU|yaAnjMshgAc`NlchAgzGdz@qc^itg@f}h@`he@zbn@{pJkudAuvH~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dOopU_Hljp@cjU_o`AcfPirI|s@rdIshb@pkJxgs@|nu@eiCcumAsop@rxPbzn@tlPazC_m_@a_]

Using both the python module and google.maps.geometry.encoding.decodePath(), the line has valid points in it (300 to be exact).

Any other line made like this works fine. What makes this line in particular not work?

bcdan
  • 1,438
  • 1
  • 12
  • 25

1 Answers1

2

The maximum length of a URL is 2,083 characters, the posted URL is at least 2154 characters

sources:

This has changed over time. The maximum length in the documentation is now 8192 characters.

Community
  • 1
  • 1
geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • Thanks. I knew about that, but since none of my other queries even came close, I was not considering that as a problem. – bcdan Jun 11 '15 at 15:51
  • Actually the URL length restriction in Google's documentation appears to be 8192 characters - manually testing the API confirms this. https://developers.google.com/maps/documentation/elevation/intro However, there may be a smaller restriction imposed by browsers, libraries, proxies etc. – Sergei Patiakin Feb 17 '17 at 18:24
  • updated the answer to reflect the fact that it has changed over time. – geocodezip Feb 17 '17 at 20:47