Open kstulgys opened 6 years ago
you can set "mapTypeId" in GoogleMap
Namely this way:
`<GoogleMapReact
bootstrapURLKeys={{ key: =<
`
Both @AonanLi and @Edeph are correct. I would want to add a comment on top of Edeph's solution. It's better to use google.maps.MapTypeId.SATELLITE
instead of the string "satellite" just to avoid typo.
Hey guys and how to know which map type is on?
I need something like this
google.maps.MapType === google.maps.MapTypeId.SATELLITE ? do something : do something
@enterthevoid
You can call getMapTypeId()
from ref
<GoogleMap
{...mapProps}
ref={ref => {
if (ref) {
console.log(ref.getMapTypeId());
}
}}
>
{children}
</GoogleMap>
However, the default mapType Id is roadmap
. Since you want to know which map type is on, you must have changed the map type by yourself, therefore you should already know what map type you are using.
I get that 'map' view but can I change it to be 'satellite' as default? I see I can change it manually in the UI but couldn't find that prop so it's always default