GoogleプレイスAPI(http://code.google.com/apis/maps/documentation/javascript/places.html)でプレイし始めたばかりですが、見えませんlatLngオブジェクトと半径ではなく、境界を渡す構文の権利を取得します。 APIドキュメントでGoogleプレイスAPIに境界を渡す
それは言う:
var bnds = map.getBounds();
console.log(bnds); // this returns a valid bounds object!
var req = {
bounds: bnds
};
var service = new google.maps.places.PlacesService(map);
service.search(req, callback);
私はページを実行すると、私はGoogleのサービスからエラーUncaught Error: Property bounds not specified
を取得:
This method takes a request with the following fields: Either of: bounds, which must be a google.maps.LatLngBounds object defining the rectangle in which to search; or a location and radius; the former takes a google.maps.LatLng object, and the radius takes a simple integer, representing the circle's radius in meters.
私のコードは次のようになります。 reqオブジェクトを
var req = {
location: latlngobject,
radius: '500'
}
に変更すると、正しく動作します。 lat/lng/radiusではなくboundsオブジェクトを渡すための適切な構文に関する考え方はありますか?
'var reqを送信するときに同じエラーが発生することを追加してください。 。 。場所:bnds' – julio
「プロパティの場所が指定されていません」と表示されます。境界線を通過するときのみ。あなたはこれを解決しましたか? APIのバグであると思われます。 – Gady