How to know if street view panorama is indoors or outdoors

前端 未结 3 1875
失恋的感觉
失恋的感觉 2020-12-08 16:44

Today more and more businesses use street view to show apartments from indoors.

My program supplies ability to show street view according to selected business. But I

相关标签:
3条回答
  • 2020-12-08 17:17

    I can't seem to find any formal API for this (maybe in the future they will implement one), and I don't think that you can be sure that indoor tiles will be with empty description.

    What I found to be working for me is using this API: Run an HTTP GET to this address: "http://cbk0.google.com/cbk?output=xml&ll=52.358445,4.88103" with the ll=LONG,LAT

    This is an internal API used to find a target location pano_id. It also gives us some information on what we can do with it: zoom levels, what streets you're on, etc.

    I've noticed that all the results for coordinates that have indoor street view images, have scene="_number" level_id="_id" in the data_properties tag of the panorama. And so, for each location you can run this request and look for these values in the data_properties of the result XML

    some examples:

    indoors:
    http://cbk0.google.com/cbk?output=xml&ll=52.358445,4.88103
    http://maps.google.com/cbk?output=xml&ll=32.051626,34.7613
    
    outdoors:
    http://cbk0.google.com/cbk?output=xml&ll=52.358766,4.880494
    http://maps.google.com/cbk?output=xml&ll=32.07782,34.785789
    

    Source: Hacking google street view

    Update

    It seems that to get local businesses right pano_id you need to add &it=all to the request example:

    http://cbk0.google.com/cbk?output=xml&hl=x-local&ll=34.058593,-118.240673&it=all
    

    this the the right pano_id for this place, you can verify it using this API

    http://cbk0.google.com/cbk?output=tile&panoid=70o9Pukc2KSjO-PfeHussw&zoom=3&x=5&y=1
    
    0 讨论(0)
  • 2020-12-08 17:22

    The ability to filter out indoor street view panoramas was implemented in Google Maps JavaScript API some time ago.

    You can use StreetViewService to search only outdoor panoramas. In the request you should specify the source as outdoor

    https://developers.google.com/maps/documentation/javascript/reference/3/#StreetViewSource

    Have a look at the following sample code that demonstrates how to get only outdoor panoramas

    var panorama;
    function initialize() {
        var svService = new google.maps.StreetViewService();
        var panoRequest = {
            location: new google.maps.LatLng(37.800953,-122.436738),
            preference: google.maps.StreetViewPreference.NEAREST,
            radius: 50,
            source: google.maps.StreetViewSource.OUTDOOR
        };
    
        svService.getPanorama(panoRequest, function(panoData, status){
            if (status === google.maps.StreetViewStatus.OK) {
                panorama = new google.maps.StreetViewPanorama(
                    document.getElementById('street-view'),
                    {
                        pano: panoData.location.pano,
                        pov: {
                            heading: 10,
                            pitch: 10
                        }
                    });
            } else {
                //Handle other statuses here
            }
        });
    }
    html, body {
      height: 100%;
      margin: 0;
      padding: 0;
    }
    #street-view {
      height: 100%;
    }
    <div id="street-view"></div>
    <script async defer
             src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDztlrk_3CnzGHo7CFvLFqE_2bUKEq1JEU&callback=initialize">
        </script>

    I hope this helps!

    0 讨论(0)
  • 2020-12-08 17:33

    Here's a feature request I filed with Google:
    "Option to disable indoor street views"
    https://code.google.com/p/gmaps-api-issues/issues/detail?id=4831

    Feel free to star the ticket there to help it get some attention

    (Is this OK etiquette-wise? ...not a real answer (yet), but seems worthy of sharing here so interested parties can star/track the ticket)

    0 讨论(0)
提交回复
热议问题