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

streetview setting heading and pitch

Open msreekm opened this issue 5 years ago • 3 comments

how do i set heading and pitch values for streetmap? I tried passing them in Googlemap and streetviewpanorama as props, does not work? also tried

const defaultOptions = { mapTypeControl: false, zoomControl: true, streetViewControl: false, disableDefaultUI: true,

};

export const StreetViewPanormaWithAnOverlayView = compose( withProps(props => { return { googleMapURL: https://maps.googleapis.com/maps/api/js?key=${ googleApiKey }&v=3.exp&libraries=geometry,drawing,places, loadingElement: <div style={{ height: 100% }} />, containerElement: <div style={{ height: 100% }} />, mapElement: <div style={{ height: 100% }} />, center: { lat: props.lat, lng: props.lng, heading: props.heading, pitch: props.pitch }, <--- does not work either! }; }), withScriptjs, withGoogleMap )(props => ( <GoogleMap defaultZoom={8} defaultCenter={props.center} defaultOptions={defaultOptions}> <StreetViewPanorama defaultPosition={props.center} visible defaultOptions={{ enableCloseButton: false }}> </StreetViewPanorama> </GoogleMap> ));

msreekm avatar Nov 10 '18 07:11 msreekm

Having the same issue.. tried multiple ways but can't figure it out. The doc says to pass them to GoogleMap as a prop but google documentation says to set it on the street view itself so I'm not too clear.

jzheng16 avatar Nov 21 '18 05:11 jzheng16

hi were you able to solve this?

aviramga avatar Apr 11 '19 14:04 aviramga

A bit late probably, but you need to define the heading and zoom as part of pov

 StreetViewPano = compose(
        withProps({
          loadingElement: <div style={{ height: '100%' }} />,
          googleMapURL: 'https://maps.googleapis.com/maps/api/js?key=key&v=3.exp&libraries=geometry,drawing,places',
          containerElement: <div style={{ height: '400px' }} />,
          mapElement: <div style={{ height: '400px' }} />,
          center: { lat: this.props.position.lat, lng: this.props.position.lng },
          pov: {
            heading: this.props.position.heading,
            pitch: this.props.position.pitch,
          },
          zoom: this.state.zoom,
        }),
        withScriptjs,
        withGoogleMap,
      )((props) => {
        return (
          <GoogleMap>
            <StreetViewPanorama
              defaultZoom={props.zoom}
              defaultPosition={props.center} 
              defaultPov={props.pov}
              onPovChanged={this.props.toggleVisibilityPostcard}
              visible
            />
          </GoogleMap>
        )
      });

KristofVDB1 avatar Jan 07 '20 09:01 KristofVDB1