Comments (4)
in fact I just update lat/lng that I get from marker position
but you're right, I could request to google addresses at that location.
But it can return more than one address, how do you want to handle that?
from jquery-addresspicker.
Hi sgruhier,
If the user changes the marker position, the variation of multiple addresses should be limited. It won't give you returns in multiple cities or even countries, like when you enter e.g. "melbourne" in the address field (would return a city in Florida and Australia). Since the results are locally limited, I would suggest just to display the first address in the google map response.
Is that possible?
from jquery-addresspicker.
display it in autocomplete suggestions?
I think if you change address textfield this could be confusing for the user.
from jquery-addresspicker.
I'm stuck at this point. All I try to do is to get the information about the town and the country in the fields left. I only need these fields to rarely address my users positions (they could enter it thierselves, but only lat, long, town and country is needed).
Could you fix this or just give me a hint how to do it?
_updatePosition seems to update only lat and long, even if I read out the ther tags from google.
here is my try:
_updatePosition: function(location) {
if (this.lat) {
this.lat.val(location.lat());
}
if (this.lng) {
this.lng.val(location.lng());
}
this.geocoder.geocode({'latLng': location}, function(results, status){
if (status == google.maps.GeocoderStatus.OK) {
//console.log(results);
if (this.locality) {
this.locality.val(this._findInfo(results[1], 'locality'));
}
if (results[1]) {
var indice=0;
for (var j=0; j<results.length; j++)
{
if (results[j].types[0]=='locality')
{
indice=j;
break;
}
}
//alert('The good number is: '+j);
console.log(results[j]);
for (var i=0; i<results[j].address_components.length; i++)
{
if (results[j].address_components[i].types[0] == "locality") {
//this is the object you are looking for
city = results[j].address_components[i];
}
if (results[j].address_components[i].types[0] == "administrative_area_level_1") {
//this is the object you are looking for
region = results[j].address_components[i];
}
if (results[j].address_components[i].types[0] == "country") {
//this is the object you are looking for
country = results[j].address_components[i];
}
}
//city data
alert(city.long_name + " || " + region.long_name + " || " + country.long_name)
//this.locality.val(city.long_name);
} else {
alert("No results found");
}
//}
} else {
alert("Geocoder failed due to: " + status);
}
});
},
from jquery-addresspicker.
Related Issues (20)
- IE9 + Later JQuery HOT 7
- jquery-addresspicker added to twitstrap resources HOT 1
- Getting this new error : not allowed by Access-Control-Allow-Origin. HOT 2
- Configure to find cities only. HOT 5
- Map Update by Address
- [enhancement] Add missing bower.json.
- jQuery UI - v1.8.24 HOT 1
- Reverse Geocoding to show current address before moving marker HOT 2
- New address picker based on typeahead HOT 3
- components filter does not work HOT 1
- Doesn't work on Firefox 12 HOT 3
- What if i have to use two markers in the same map?? HOT 5
- Problem with map inside Jquery Steps HOT 2
- Google Places HOT 4
- specification of an administrative area in a componentsFilter
- when make build with gulp bower files not working
- Regarding to timezone
- Is it possible to get suggestions without state/area
- How to make "Reverse Geocode" to be True by default? HOT 2
- Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-addresspicker.