Using a custom image marker on google static map?

前端 未结 3 1642
轮回少年
轮回少年 2021-02-02 09:29

how to have custom image marker on google static map, i need url format:

this is what i have tried, but its having default marker image http://maps.google.com/maps/a

3条回答
  •  萌比男神i
    2021-02-02 10:07

    According to the documentation you can specify custom icons like so:

    markers=icon:...

    e.g. amending your URL:

    http://maps.google.com/maps/api/staticmap?center=25.3176452,82.97391440000001,&zoom=15&markers=icon:http://www.megaadresse.com/images/icons/google-maps.png|25.3176452,82.97391440000001&path=color:0x0000FF80|weight:5|25.3176452,82.97391440000001&size=175x175

    Gives you:

    PS: the sensor parameter is no longer required.

    PPS: also you seemed to have specified the same coordinates twice in your markers parameter, so it was actually drawing two markers on the same location.

提交回复
热议问题