I am processing addresses into their respective field format for the database. I can get the house number out and the street type but trying to determine best method to get the
I currently just pass whatever I am given to googlemaps and have them send back a formatted street address that is very easy to parse.
function addressReview(addressInput) {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
geocoder.geocode( { 'address': addressInput}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
var addr = results[0].formatted_address;
var latTi = results[0].geometry.location.lat();
var lonGi = results[0].geometry.location.lng();
$.post('/welcome/gcode',{ add: addr , la: latTi , lo: lonGi });
$('#cust_addy').val(addr);
} else {
$('#cust_addy').attr("placeholder",'Cannnot determine location');
}
} else {
$('#cust_addy').attr("placeholder",'Cannnot determine location');
}
});
}
After that, I just split it up in ruby. with .split(', ') and .split(' ')