@@ -71,10 +71,9 @@ var Codeweek = window.Codeweek || {};
71
71
selectItemByValue ( choice , country ) ;
72
72
}
73
73
74
-
75
- function updateAddress ( new_position ) {
74
+ function updateAddress ( new_latLng ) {
76
75
geocoder = new google . maps . Geocoder ( ) ;
77
- geocoder . geocode ( { 'latLng' : new_position } , function ( results , status ) {
76
+ geocoder . geocode ( { 'latLng' : new_latLng } , function ( results , status ) {
78
77
if ( status === google . maps . GeocoderStatus . OK ) {
79
78
document . getElementById ( "autocomplete" ) . value = results [ 0 ] . formatted_address ;
80
79
// the last item in the geocoder for latLng results array is the country
@@ -127,19 +126,11 @@ var Codeweek = window.Codeweek || {};
127
126
}
128
127
129
128
function fillInAddress ( ) {
130
- var place = autocomplete . getPlace ( ) ,
131
- components = place . address_components ,
132
- output = autocomplete . getPlace ( ) . geometry . location ,
133
- outputLat = output . lat ( ) ,
134
- outputLng = output . lng ( ) ,
135
- locLatlng = new google . maps . LatLng ( outputLat , outputLng ) ;
136
-
137
- document . getElementById ( "id_geoposition_0" ) . value = outputLat ;
138
- document . getElementById ( "id_geoposition_1" ) . value = outputLng ;
139
-
140
- createMarker ( locLatlng ) ;
141
- updateCountrySelection ( output ) ;
142
-
129
+ // geoLatLng contains the Google Maps geocoded latitude, longitude
130
+ var geoLatLng = autocomplete . getPlace ( ) . geometry . location ;
131
+
132
+ createMarker ( geoLatLng ) ;
133
+ updateAddress ( geoLatLng ) ;
143
134
}
144
135
145
136
function auto_complete ( ) {
0 commit comments