Я хочу получить все почтовые индексы в определенном месте, где я нажимаю. Я хочу сделать это с angular-js
.
Ссылка ниже покажет точную демонстрацию:
https://www.freemaptools.com/find-indian-pincodes-inside-radius.htm
Я хочу сделать это с помощью angular-js
<!DOCTYPE html>
<html>
<head>
<title>zip code to location</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#floating-panel {
position: absolute;
top: 10px;
left: 25%;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
text-align: center;
font-family: 'Roboto','sans-serif';
line-height: 30px;
padding-left: 10px;
}
</style>
</head>
<body>
<div id="floating-panel">
<input id="address" type="textbox" value="679321">
<input id="submit" type="button" value="Find Location">
</div>
<div id="map"></div>
<script>
var marker = null;
var circle = null;
var infowindow = new google.maps.InfoWindow({
size: new google.maps.Size(150,50)
});
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: {lat: 20.5937, lng: 78.9629}
});
var geocoder = new google.maps.Geocoder();
document.getElementById('submit').addEventListener('click', function() {
geocodeAddress(geocoder, map);
});
}
function geocodeAddress(geocoder, resultsMap) {
if (marker) {
marker.setMap(null);
marker = null;
circle.setMap(null);
circle = null;
}
var address = document.getElementById('address').value;
geocoder.geocode({'address': address}, function(results, status) {
if (status === 'OK') {
resultsMap.setCenter(results[0].geometry.location);
marker = new google.maps.Marker({
map: resultsMap,
position: results[0].geometry.location
});
circle = new google.maps.Circle({
map: resultsMap,
radius: 5000, // 5km in metres
fillColor: '#AA0000'
});
circle.bindTo('center', marker, 'position');
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?components=country:DE&key=&callback=initMap">
</script>
</body>
</html>
Когда явставьте почтовый индекс, это отметит соответствующий регион. Теперь я хочу перечислить или получить все остальные почтовые индексы в радиусе 5 километров.