我在佛罗里达州奥兰多市周围设置的5英里范围内无效。我不太确定我做错了什么。任何帮助将不胜感激。
<input id="autocomplete" placeholder="Enter your address" type="text"></input>
function initAutocomplete() {
//5 mile bounds around orlando, fl
var streetLng = -81.43061;
var streetLat = 28.56683;
var center = new google.maps.LatLng(parseInt(streetLat), parseInt(streetLng));
var north = google.maps.geometry.spherical.computeOffset(center, 5, 0).lat();
var east = google.maps.geometry.spherical.computeOffset(center, 5, 90).lng();
var south = google.maps.geometry.spherical.computeOffset(center, 5, 180).lat();
var west = google.maps.geometry.spherical.computeOffset(center, 5, -90).lng();
var defaultBounds = new google.maps.LatLngBounds(new google.maps.LatLng(north, east), new google.maps.LatLng(south, west));
new google.maps.places.Autocomplete(
(document.getElementById('autocomplete')), {
componentRestrictions: { country: "us" }, types: ['address'], bounds: defaultBounds
});
}
initAutocomplete();
https://jsfiddle.net/wybsfvLb/2/
由于
答案 0 :(得分:0)
我切换了defaultBounds。代码应如下所示
system.time(sum(data.table(ids, dates)[, .N > 1, .(ids, dates)]$V1))
# user system elapsed
# 0.05 0.00 0.05
system.time(sum(table(ids, dates)>1))
# user system elapsed
# 0.87 0.19 1.07