react-google-maps-api icon indicating copy to clipboard operation
react-google-maps-api copied to clipboard

Data-driven style

Open ericwallen opened this issue 2 years ago • 1 comments

Hello, I am trying to use data-driven styling. Tried implementing it like this:

    const onLoad = useCallback(function callback(map) {

        const bounds = new window.google.maps.LatLngBounds(center)
        map.fitBounds(bounds);

        let layer = map.getFeatureLayer(window.google.maps.FeatureType.COUNTRY)
        layer.style = {
            'strokeColor': 'blue',
            'strokeWeight' : 1
        }

        setMap(map)
    }, [])

Does anyone know how to implement this correctly? I am kinda scratching my head right now. Tried using the information from this video https://www.youtube.com/watch?v=tAR63GBwk90 but not getting anywhere with it.

Any help would be much appreciated. Thanks!

ericwallen avatar May 31 '23 21:05 ericwallen

I implemented Data driven using @ubilabs/google-maps-react-hooks this library

subu873 avatar Jun 08 '23 17:06 subu873