-1
以下の機能から緯度と経度を取得する方法。Googleマップのapiからlong latを取得する方法
<script>
getPlace_dynamic();
function getPlace_dynamic() {
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(-33.8902, 151.1759),
new google.maps.LatLng(-33.8474, 151.2631)
);
var input = document.getElementsByClassName('formcontrol');
var options = {
bounds: defaultBounds,
types: ['establishment']
};
for (i = 0; i < input.length; i++) {
autocomplete = new google.maps.places.Autocomplete(input[i], options);
}
}
</script>
私は
document.getElementById('tolat').value = place.geometry.location.lat();
document.getElementById('tolong').value = place.geometry.location.lng();