How to add custom marker image Google Static Map
Asked Answered
F

3

5

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.

Frederickson answered 28/7, 2015 at 6:42 Comment(0)
R
7

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

Refund answered 28/7, 2015 at 7:24 Comment(2)
I need to add marker along with polyline encoded route static map .i think there is no option available for that.Frederickson
@RamkumarP Why wouldn't that work? Seems fine to me. I'll update my answer with an example showing a custom map and an encoded polyline.Refund
E
1

it is very common question and very simple soluion for that to Add only

&markers=icon:http://tinyurl.com/2ftvtt6|lat,lng 

while hitting that Api.so simply your APi must be see like this http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:http://tinyurl.com/2ftvtt6|40.714728,-73.998672&zoom=12&size=400x400&sensor=false

and for more info please visit http://phpidiots.in/android/google-static-map-api/

:) enjoy your code

Evolute answered 18/9, 2015 at 20:10 Comment(0)
G
0

I help solution here for the marker in google compose Android : enter link description here

Gaucho answered 14/12, 2022 at 7:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.