Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom marker image Google Static Map

How to add custom marker image Google Static Map?

I am using the following URL in order to get a static map

https://maps.googleapis.com/maps/api/staticmap?size=250x250&markers=color:red%7C$marker_start&markers=color:green%7C$marker_end&path=weight:3%7Ccolor:red%7Cenc:$encodedString

I am only able to change color and add a marker that already exists but not the image that created by me.

like image 864
Ramkumar P Avatar asked Jul 28 '15 06:07

Ramkumar P


1 Answers

Yes, the documentation has a section explaining how to use your own images instead of their markers: https://developers.google.com/maps/documentation/staticmaps/intro#CustomIcons

e.g.

https://maps.googleapis.com/maps/api/staticmap?markers=icon:http://www.example.com/yourimage.png

Here's an example using an encoded polyline too.

https://maps.googleapis.com/maps/api/staticmap?markers=icon:http://www.gravatar.com/avatar/e5594b71e9f54f3e73f6294b054f5616?s=32%26d=identicon%26r=PG|54.763228,-130.617302&size=400x400&path=weight:3%7Ccolor:orange%7Cenc:_fisIp~u%7CU}%7Ca@pytA_~b@hhCyhS~hResU%7C%7Cx@oig@rwg@amUfbjA}f[roaAynd@%7CvXxiAt{ZwdUfbjAewYrqGchH~vXkqnAria@c_o@inc@k{g@i%60]o%7CF}vXaj\h%60]ovs@?yi_@rcAgtO%7Cj_AyaJren@nzQrst@zuYh%60]v%7CGbldEuzd@%7C%7Cx@spD%7CtrAzwP%7Cd_@yiB~vXmlWhdPez\_{Km_%60@~re@ew^rcAeu_@zhyByjPrst@ttGren@aeNhoFemKrvdAuvVidPwbVr~j@or@f_z@ftHr{ZlwBrvdAmtHrmT{rOt{Zz}E%7Cc%7C@o%7CLpn~AgfRpxqBfoVz_iAocAhrVjr@rh~@jzKhjp@%60%60NrfQpcHrb^k%7CDh_z@nwB%7Ckb@a{R%7Cyh@uyZ%7CllByuZpzw@wbd@rh~@%7C%7CFhqs@teTztrAupHhyY}t]huf@e%7CFria@o}GfezAkdW%7C}[ocMt_Neq@ren@e~Ika@pgE%7Ci%7CAfiQ%7C%60l@uoJrvdAgq@fppAsjGhg%60@%7ChQpg{Ai_V%7C%7Cx@mkHhyYsdP%7CxeA~gF%7C}[mv%60@t_NitSfjp@c}Mhg%60@sbChyYq}e@rwg@atFff}@ghN~zKybk@fl}A}cPftcAite@tmT__Lha@u~DrfQi}MhkSqyWivIumCria@ciO_tHifm@fl}A{rc@fbjAqvg@rrqAcjCf%7Ci@mqJtb^s%7C@fbjA{wDfs%60BmvEfqs@umWt_Nwn^pen@qiBr%60xAcvMr{Zidg@dtjDkbM%7Cd_@

enter image description here

like image 77
duncan Avatar answered Oct 02 '22 12:10

duncan