title: Is it possible to call a Google API and get the map image and save the image in somewhere
body: <p>I am currently working on sending a google map image in an html email . </p>
  
  <p>Currently I am using <a href="https://developers.google.com/maps/documentation/static-maps/" rel="nofollow">static-maps-api</a> to achieve my task . i will call the static maps api and set the image URL as <code>src</code> In an image tag .</p>
  
  <pre><code>&lt;img src="https://maps.googleapis.com/maps/api/staticmap?markers=icon:http://mailadapterdev.vanapi.com/static/start.png|13.82,100.54&amp;markers=icon:http://mailadapterdev.vanapi.com/static/waypt1.png|13.80,100.54&amp;markers=icon:http://mailadapterdev.vanapi.com/static/waypt2.png|13.81,100.52&amp;markers=icon:http://mailadapterdev.vanapi.com/static/waypt3.png|13.79,100.54&amp;markers=icon:http://mailadapterdev.vanapi.com/static/dest.png|13.79,100.53&amp;path=weight:3|color:blue|enc:cfjsAqvsdRnAMd@MZpDLpATpB?HGLMX?VV`CTjBr@L|ATlDf@hBXGl@CPTDtAR~Et@jF`AnLbBvKdB~@JbAR`BTdDd@pDj@l@H`Cb@vALFOJIr@yCxAgHPYTOREV?N@ZHrIxD|HjD~CxAxAn@j@XHDZy@hAoCdCiG~B{Gj@gBXeALWNU@[A[OWi@m@_@_@i@w@O[o@SSKK?}A]sBy@wBeAvBdArBx@|A\J?JOIsCJgC?[Io@KQ^Nn@TLDUfDC`AFp@RfAj@dAl@p@n@n@DHDN?TC`@IFW^MVYdAKZMb@uBdGaDfIiAnC[x@B@RHpCnAnAh@jChAnVrK|@`@Uh@iChG{D~J}B~Fe@tAq@fCcBfG_ApDMd@AXO`@Q^GCu@S{AAyIByEAaABc@@}A@kACeDImKWcKSmAGgAEoCCqECI?LlCH~DI_EMmCH?|@BdA?lA?nCBfADlAFrDHnEH|ELtIRjAB|AAb@A`ACxE@xICzA@l@Oh@a@p@}BhDoMd@yA~AcE`AiCtDsJhCeGHSHs@b@_Ej@cGbAuJ\mC|@sGb@gENoBF]XkAZuBX}CLoA@CbAJbDXl@Fm@GcDYcAKABMnAOzAI`AKr@_@pBQx@OnBUdCYbCk@tDCR~@VTL~@t@xBz@|GrB`I`CYnA_BpH{A`H&amp;key=MY_API_KEY=400x400" &gt;
  </code></pre>
  
  <p>before calling the static maps api , i will call the <a href="https://developers.google.com/maps/documentation/directions/" rel="nofollow">directions-api</a>
  with the lat long and get the polyline , with polyline I get from the call directions API i will call the static maps API.</p>
  
  <p><strong>My Problem Is</strong></p>
  
  <p>When the number of way points increase ( more than 5 normally ) the polyline become very large and the URL will become long , if it is larger than 2048 characters , i cannot view my map . google does not identify it as a valid URL. so it is obvious .</p>
  
  <p><strong>My Questions Are</strong></p>
  
  <ol>
  <li>Is there anyway to reduce the size of the ploy line ?</li>
  <li>Is there anyway to call a Google API and get the image and save it in my server.</li>
  <li>If I can do the second point, is it illegal to save google maps in the my server, instead of call google server to get the image every time I want.</li>
  <li>Is there any other ways I can achieve my task.</li>
  </ol>
  
  <p>I am stuck in this problem for more than 2 weeks now. I almost tried everything. please help me to solve this issue . </p>
  
  <p>Thank you in advance.</p>