質問

I am currently working on a project where the user can use Street View to locate a restaurant. Is there a way, using a maps API in JavaScript, to locate the nearest restaurant?

Basically, I want the user to hit a button, which places a pin on the nearest restaurant. I want the pin to be placed based on their street view location, not their real location. So you could be using it in Thailand but have street view enabled and be in London, so that it would find the nearest restaurant from there.

Any ideas how to get nearest restaurants?

Thanks.

役に立ちましたか?

解決

You can use google places API.

The response will contain a "geometry" property like the following :

     "geometry" : {
        "location" : {
           "lat" : -33.8731950,
           "lng" : 151.2063380
        }
     }

You can use those coordinates to create a link to streetview. See https://developers.google.com/maps/documentation/streetview/#url_parameters

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top