17
Views
4
Comments
Solved
[Google Maps Library] Resize Custom Marker on Google Map Library (Mobile)
google-maps-mobile
Reactive icon
Forge asset by Labs

Hello, 

i want to resize my custom marker icon size to the default marker size. I already try adding this

"{size: new google.maps.Size(20, 32)}"  in MarkerOptions but get "error parsing options JSON string. Using default options." warning message.

do anyone know why it doesn't work? thank you!


2024-03-14 12-00-57
Carlos Costa
Solution

Hello Joshua, 
After some investigation, the marker options doesn't allow to change the size of the marker:

https://developers.google.com/maps/documentation/javascript/reference/marker
It's also deprecated which means that the module from the forge will eventually be updated to start using the AdvancedMarker instead.
In the meantime, one option that you have is resize the image to the size that you need, upload it to your solution and just use the image with the correct size.

2024-03-21 06-51-55
Joshua Benaya

Hi Carlos,

Thanks for the help!
Can i in any way apply CSS in the marker options JSON?

2024-03-14 12-00-57
Carlos Costa

Hello Joshua,

Can you try the following code ?


"{ scaledSize: Size {    width: 20,    height: 32  } } " 

2024-03-21 06-51-55
Joshua Benaya

Hi Carlos,

I already try your solution but it still give me the "error parsing options JSON String"

2024-03-14 12-00-57
Carlos Costa
Solution

Hello Joshua, 
After some investigation, the marker options doesn't allow to change the size of the marker:

https://developers.google.com/maps/documentation/javascript/reference/marker
It's also deprecated which means that the module from the forge will eventually be updated to start using the AdvancedMarker instead.
In the meantime, one option that you have is resize the image to the size that you need, upload it to your solution and just use the image with the correct size.

2024-03-21 06-51-55
Joshua Benaya

Hi Carlos,

Thanks for the help!
Can i in any way apply CSS in the marker options JSON?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.