0
I applied viacep.com javascript in a form, so when the ZIP code is informed, it completes data such as address without number, city, state and neighborhood. I would like, with this information, to display this street on google maps. After a user click, place a marker on this map that would complete the street number and the latitude and longitude of this marker. Below, I show q already managed for now: just display the map with center in sp state.
<form method="get" action=".">
<label for="cep">
<span>Cep: <span class="required">*</span></span>
<input class="input-field" name="cep" type="text" id="cep" value="" size="10" maxlength="9" onblur="pesquisacep(this.value);" />
</label>
<br>
<label for="rua">
<span>Rua:</span>
<input class="input-field" name="rua" type="text" id="rua" size="60" />
</label>
<br>
<label for="bairro">
<span>Bairro:</span>
<input class="input-field" name="bairro" type="text" id="bairro" size="40" />
</label>
<br>
<label for="field4">
<span>Cidade:</span>
<input class="input-field" name="cidade" type="text" id="cidade" size="40" />
</label>
<br>
<label for="uf">
<span>Estado:</span>
<input class="input-field" name="uf" type="text" id="uf" size="2" />
</label>
<br>
</form>
<label><div id="googleMap" style="width: 100%; height: 300px;"></div></label>
<script type="text/javascript">
function myMap() {
var mapProp= {
center:new google.maps.LatLng(-23,-46),
zoom:5,
mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new google.maps.Map(document.getElementById("googleMap"),mapProp);
var marker = new google.maps.Marker({position: myCenter});
marker.setMap(map);
}
</script>