I am currently working on sending a google map image in an html email .
Currently I am using static-maps-api to achieve my task . i will call the static maps api and set the image URL as src
In an image tag .
<img src="https://maps.googleapis.com/maps/api/staticmap?markers=icon:http://mailadapterdev.vanapi.com/static/start.png|13.82,100.54&markers=icon:http://mailadapterdev.vanapi.com/static/waypt1.png|13.80,100.54&markers=icon:http://mailadapterdev.vanapi.com/static/waypt2.png|13.81,100.52&markers=icon:http://mailadapterdev.vanapi.com/static/waypt3.png|13.79,100.54&markers=icon:http://mailadapterdev.vanapi.com/static/dest.png|13.79,100.53&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&key=MY_API_KEY=400x400" >
before calling the static maps api , i will call the directions-api with the lat long and get the polyline , with polyline I get from the call directions API i will call the static maps API.
My Problem Is
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 .
My Questions Are
- Is there anyway to reduce the size of the ploy line ?
- Is there anyway to call a Google API and get the image and save it in my server.
- 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.
- Is there any other ways I can achieve my task.
I am stuck in this problem for more than 2 weeks now. I almost tried everything. please help me to solve this issue .
Thank you in advance.