2

How to use Google Static Map Path API for showing a path containing more than 1000 lat-longs points? I tried encoding the latlong using PolyUtils.encode() but still the the final url formed using encoded string exceeds the url length limit of 2048.

  • I have the same issue like yours. I think you can not draw real path with static map API. Yes I succeed in displaying path but it is just a straight line nothing more. – Hitesh Kamani Aug 13 '15 at 06:14
  • I think that's limitation when use Google Map with free. – Neo Aug 13 '15 at 06:22
  • @MrNeo So, do they provide different API for paid? – dheeraj sharma Aug 13 '15 at 06:54
  • you could access [here](https://www.google.com/work/mapsearth/?utm_source=contact&utm_medium=email&utm_content=marketo&utm_campaign=NA-LCS-2012-Geo-TOS_2.0) and click **Get in touch** to contact them for more information. – Neo Aug 13 '15 at 07:03
  • @MrNeo Yeah I just did. Thanks!! – dheeraj sharma Aug 13 '15 at 07:24
  • @dheerajsharma, can you please tell me what the contact person replied about google static api? do we need to purchase google static map api for that? – Hitesh Kamani Aug 13 '15 at 09:39
  • @HiteshKamani Till now no response from there side. – dheeraj sharma Aug 13 '15 at 19:05
  • @dheerajsharma Please let me know if you find any solutions regarding this issue. – Hitesh Kamani Aug 14 '15 at 04:58
  • @HiteshKamani there is no API they asked me to use Google maps. But I can't use multiple maps in same fragment so going to write a logic to ignore some of the points. – dheeraj sharma Aug 17 '15 at 07:45
  • @dheerajsharma. Thanks a lot buddy for reply. I need to display map in listview row with path drawn on map. I have heard about google map lite mode but not yet implemented. will implement it soon. if you find any solution please let me know. thanks in advanced. – Hitesh Kamani Aug 17 '15 at 07:53
  • @HiteshKamani Can we show multiple maps?I dont think so. Please let me know what you find. – dheeraj sharma Aug 17 '15 at 09:32

2 Answers2

0

Short answer: you can't pass more than 2048 characters. It's not possible to do it with the Google Static Maps API.

On the other hand, you could use the JavaScript API and take a snapshot with html2canvas.js.

See the example I provided in this other post: https://stackoverflow.com/a/37750987/4537906

Community
  • 1
  • 1
Soldeplata Saketos
  • 3,212
  • 1
  • 25
  • 38
0

Recently, the URL length limit was changed to 8192 characters as the response of feature request in public issue tracker.

https://developers.google.com/maps/documentation/static-maps/intro#url-size-restriction

xomena
  • 31,125
  • 6
  • 88
  • 117