How do I limit google streetview response to strictly google panoramas?

53 Views Asked by At

Is there any way for me to limit returned streetview pano's to only google instances. I tried setting StreetViewSource.GOOGLE for sources but still keep getting an outdated, non google pano which is strange to me. I haven't seen this being an issue until the recent changes that were introduced onto the map platforms

This is the lat lng that I am trying to access: 37.41229382514552, -79.19579734183662 It is resorting to shentel communications pano and not google, even though there is a more recent streetview pano available.

async function findNearestStreetView(location, radius) {
    const {StreetViewService, StreetViewPreference, StreetViewSource} = await google.maps.importLibrary("streetView");
    
    var streetViewService = new StreetViewService();

    // Setting options for Street View request
    var streetViewOptions = {
        location: location,
        radius: radius,
        sources: [StreetViewSource.GOOGLE], // Limiting searches to official Google collections
        preference: StreetViewPreference.NEAREST
    };

    streetViewService.getPanorama(streetViewOptions, function(result, status) {
        if (status === 'OK') {
            // Found an official Google panorama within the given radius
            panorama.setPosition(result.location.latLng);
            panorama.setPov({ heading: 0, pitch: 0 });
            // Optionally, you can send metadata to the server or handle it as needed
            sendMetadataToServer(result.location);
        } else {
            console.log('No Google Street View available within the specified radius.');
        }
    });
}
0

There are 0 best solutions below