Search Results

Search found 101 results on 5 pages for 'geocode'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Getting an "i" from GEvent

    - by Cosizzle
    Hello, I'm trying to add an event listener to each icon on the map when it's pressed. I'm storing the information in the database and the value that I'm wanting to retrive is "i" however when I output "i", I get it's last value which is 5 (there are 6 objects being drawn onto the map) Below is the code, what would be the best way to get the value of i, and not the object itself. var drawLotLoc = function(id) { var lotLoc = new GIcon(G_DEFAULT_ICON); // create icon object lotLoc.image = url+"images/markers/lotLocation.gif"; // set the icon image lotLoc.shadow = ""; // no shadow lotLoc.iconSize = new GSize(24, 24); // set the size var markerOptions = { icon: lotLoc }; $.post(opts.postScript, {action: 'drawlotLoc', id: id}, function(data) { var markers = new Array(); // lotLoc[x].description // lotLoc[x].lat // lotLoc[x].lng // lotLoc[x].nighbourhood // lotLoc[x].lot var lotLoc = $.evalJSON(data); for(var i=0; i<lotLoc.length; i++) { var spLat = parseFloat(lotLoc[i].lat); var spLng = parseFloat(lotLoc[i].lng); var latlng = new GLatLng(spLat, spLng) markers[i] = new GMarker(latlng, markerOptions); myMap.addOverlay(markers[i]); GEvent.addListener(markers[i], "click", function() { console.log(i); // returning 5 in all cases. // I _need_ this to be unique to the object being clicked. console.log(this); }); } });

    Read the article

  • How to distinguish a NY "queens-style" street address from a ranged address, and an address with a u

    - by feroze
    I need to distinguish between a Queens style address, from a valid ranged address, and an address with a unit#. For eg: Queens style: 123-125 Some Street, NY Ranged Address: 6414-6418 37th Ln SE, Olympia, WA 98503 Address with unit#: 1990-A Gildersleeve Ave, Bronx, NY. In the case of #3, A is a unit# at street address 1990. THe unit# might be a number as well, for eg: 1990-12. A ranged address identifies a range of addresses on a street, and not a unique deliverable address. So, the question is, is there an easy way to identify the Queens style address from the other cases?

    Read the article

  • Are the formatted addresses of a Google location unique?

    - by Hans
    I want our users of a web site to be able to either search and pick an address or mark a location on a map decide how accurate this address/location is I am in the process of implementing the first part with jquery, jquery ui's autocomplete, google map, and google geocoder. For the second part I will generate a radiobutton list based on the address elements/alternatives of the first part on the client side with jquery. My concern, however, is how to convey the choices to the server side. The Google geocoder includes a number of useful metadata that I want to store. A possibility is to store the complete json object in a hidden form field, but I can't trust the users. Such a solution would enable an unfriendly insertion of spam in the data. If the addresses/locations would have a unique identifyer I could store just these and let the server refetch/evaluate the data. The alternative geonames.org web service has such ids. But are for example the formatted addresses of a Google location unique? Any tips?

    Read the article

  • How can I best geocode a table of addresses in SQL Server?

    - by ess
    I've got a SQL Server 2008 table with addresses. I've got some C# code that can individually geocode the addresses. I've got a Google Maps API for geocoding. Now I'm trying to figure out the most efficient way to use these resources. I could write a console app that manually updates the tables using my C# library, but the data I have is updated periodically. I will be performing an import routine of some sort and I'm thinking it would be 'simplest' to perform the geocoding as the import occurs. I'm not so strong on SQL Server capabilities, so I'm looking for advice. I've considered letting the import call an assembly I create that would be referenced in SQL Server, but read that Sql Server 2008 has made it virtually impossible to reference your own DLL. So my next guess is having the import call a web service to pass in the address and update the table with the results, but I've not had much luck in finding info on this method. Any advice?

    Read the article

  • Reverse geocode coordinates to street address and setting as subtitle in annotation?

    - by Krismutt
    Hey everybody! Basically I wanna reverse geocode my coordinates for my annotation and show the address as the subtitle for the annotation. I just cant figure out how to do it... savePosition.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> #import <MapKit/MKReverseGeocoder.h> #import <AddressBook/AddressBook.h> @interface savePosition : NSObject <MKAnnotation, MKReverseGeocoderDelegate> { CLLocationCoordinate2D coordinate; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; -(id)initWithCoordinate:(CLLocationCoordinate2D) coordinate; - (NSString *)subtitle; - (NSString *)title; @end savePosition.m @synthesize coordinate; -(NSString *)subtitle{ return [NSString stringWithFormat:@"%f", streetAddress]; } -(NSString *)title{ return @"Saved position"; } -(id)initWithCoordinate:(CLLocationCoordinate2D) coor{ coordinate=coor; NSLog(@"%f,%f",coor.latitude,coor.longitude); return self; MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate]; geocoder.delegate = self; [geocoder start]; } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{ NSString *streetAddress = [NSString stringWithFormat:@"%@", [placemark.addressDictionary objectForKey:kABPersonAddressStreetKey]]; } @end any ideas?? Thanks in advance!

    Read the article

  • A few questions about a Rails model for a simple addressbook app

    - by user284194
    I have a Rails application that lists information about local services. My objectives for this model are as follows: 1. Require the name and tag_list fields. 2. Require one or more of the tollfreephone, phone, phone2, mobile, fax, email or website fields. 3. If the paddress field has a value, then encode it with the Geokit plugin. Here is my entry.rb model: class Entry < ActiveRecord::Base validates_presence_of :name, :tag_list validates_presence_of :tollfreephone or :phone or :phone2 or :mobile or :fax or :email or :website acts_as_taggable_on :tags acts_as_mappable :auto_geocode=>{:field=>:paddress, :error_message=>'Could not geocode physical address'} before_save :geocode_paddress validate :required_info def required_info unless phone or phone2 or tollfreephone or mobile or fax or email or website errors.add_to_base "Please have at least one form of contact information." end end private def geocode_paddress #if paddress_changed? geo=Geokit::Geocoders::MultiGeocoder.geocode (paddress) errors.add(:paddress, "Could not Geocode address") if ! geo.success self.lat, self.lng = geo.lat,geo.lng if geo.success #end end end Requiring name and tag_list work, but requiring one (or more) of the tollfreephone, phone, phone2, mobile, fax, email or website fields does not. As for encoding with Geokit, in order to save a record with the model I have to enter an address. Which is not the behavior I want. I would like it to not require the paddress field, but if the paddress field does have a value, it should encode the geocode. As it stands, it always tries to geocode the incoming entry. The commented out "if paddress_changed?" was not working and I could not find something like "if paddress_exists?" that would work. Help with any of these issues would be greatly appreciated. I posted three questions pertaining to my model because I'm not sure if they are preventing each other from working. Thank you for reading my questions.

    Read the article

  • Javascript closures with google geocoder

    - by DaNieL
    Hi all, i still have some problems with javascript closures, and input/output variables. Im playing with google maps api for a no profit project: users will place the marker into a gmap, and I have to save the locality (with coordinates) in my db. The problem comes when i need to do a second geocode in order to get a unique pairs of lat and lng for a location: lets say two users place the marker in the same town but in different places, I dont want to have the same locality twice in the database with differents coords. I know i can do the second geocode after the user select the locality, but i want to understand what am i mistaking here: // First geocoding, take the marker coords to get locality. geocoder.geocode( { 'latLng': new google.maps.LatLng($("#lat").val(), $("#lng").val()), 'language': 'it' }, function(results_1, status_1){ // initialize the html var inside this closure var html = ''; if(status_1 == google.maps.GeocoderStatus.OK) { // do stuff here for(i = 0, geolen = results_1[0].address_components.length; i != geolen) { // Second type of geocoding: for each location from the first geocoding, // i want to have a unique [lat,lan] geocoder.geocode( { 'address': results_1[0].address_components[i].long_name }, function(results_2, status_2){ // Here come the problem. I need to have the long_name here, and // 'html' var should increment. coords = results_2[0].geometry.location.toUrlValue(); html += 'some html to let the user choose the locality'; } ); } // Finally, insert the 'html' variable value into my dom... //but it never gets updated! } else { alert("Error from google geocoder:" + status_1) } } ); I tryed with: // Second type of geocoding: for each location from the first geocoding, i want // to have a unique [lat,lan] geocoder.geocode( { 'address': results_1[0].address_components[i].long_name }, (function(results_2, status_2, long_name){ // But in this way i'll never get results_2 or status_2, well, results_2 // get long_name value, status_2 and long_name is undefined. // However, html var is correctly updated. coords = results_2[0].geometry.location.toUrlValue(); html += 'some html to let the user choose the locality'; })(results_1[0].address_components[i].long_name) ); And with: // Second type of geocoding: for each location from the first geocoding, i want to have // a unique [lat,lan] geocoder.geocode( { 'address': results_1[0].address_components[i].long_name }, (function(results_2, status_2, long_name){ // But i get an obvious "results_2 is not defined" error (same for status_2). coords = results_2[0].geometry.location.toUrlValue(); html += 'some html to let the user choose the locality, that can be more than one'; })(results_2, status_2, results_1[0].address_components[i].long_name) ); Any suggestion? EDIT: My problem is how to pass an additional arguments to the geocoder inner function: function(results_2, status_2, long_name){ //[...] } becose if i do that with a clousure, I mess with the original parameters (results_2 and status_2)

    Read the article

  • Geocoding non-addresses: Geopy

    - by Phil Donovan
    Using geopy to geocode alcohol outlets in NZ. The problem I have is that some places do not have street addresses but are places in Google Maps. For example, plugging: Furneaux Lodge, Endeavour Inlet, Queen Charlotte Sound, Marlborough 7250 into Google Maps via the browser GUI gives me However, using that in Geopy I get a GQueryError saying this geographic location does not exist. Here is the code for geocoding: def GeoCode(address): g=geocoders.Google(domain="maps.google.co.nz") geoloc = g.geocode(address, exactly_one=False) place, (lat, lng) = geoloc[0] GeoOut = [] GeoOut.extend([place, lat, lng]) return GeoOut GeoCode("Furneaux Lodge, Endeavour Inlet, Queen Charlotte Sound, Marlboroguh 7250") Meanwhile, I notice that "Eiffel Tower" works fine. Is there away to solve this and can someone explain the difference between The Eiffel Tower and Furneaux Lodge within Google 'locations'?

    Read the article

  • HOw Do I update from table-2 to table-1

    - by mathew
    HI what is the wrong in this code?? i have set it 24 hours to update the value in the table.but the problem is if $row is empty then it inserts value from table-2 but after 24 hours it wont update the value. what I want is it must delete the existing value and insert new one(random value) or it must update the same $row with new value what ever... if ($row == 0){ mysql_query("INSERT INTO table-1 (regtime,person,location,address,rank,ip,geocode) SELECT NOW(),person,location,address,rank,ip,geocode FROM table-2 ORDER BY RAND() LIMIT 1");}else{ mysql_query("UPDATE table-1 SELECT regtime=NOW(), person=person, location=location, address=address, rank=rank, ip=ip, geocode=geocode FROM table-2 ORDER BY RAND() LIMIT 1");}

    Read the article

  • Rails validation issue with before_validation

    - by Chance
    I'm still fairly new to rails so I'm not sure what I'm missing here. I'm using GeoKit to geocode an address upon saving. I have a method that geocodes an address and if it fails to find it, it adds an error to the errors list. I've tested it in the console and it is failing on the geocode (presumably adding the error) but still saving successfully. acts_as_mappable before_validation_on_create :geocode_address before_validation_on_update :geocode_address validates_presence_of :street validates_presence_of :city validates_presence_of :state validates_presence_of :zip validates_presence_of :name validates_uniqueness_of :name def geocode_address geo=Geokit::Geocoders::MultiGeocoder.geocode ("#{street}, #{city}, #{state}, #{zip}") puts "geocoded: #{street}, #{city}, #{state}, #{zip}" if geo.success self.lat, self.lng = geo.lat,geo.lng else errors.add(:street, "Could not Geocode address") end puts "geo status: #{geo.success}" end Any help would be greatly appreciated, thanks :)

    Read the article

  • AsyncTask and Contexts

    - by Michael
    So I'm working out my first multi-threaded application using Android with the AsyncTask class. I'm trying to use it to fire off a Geocoder in a second thread, then update the UI with onPostExecute, but I keep running into an issue with the proper Context. I kind of hobbled my way through using Contexts on the main thread, but I'm not exactly sure what the Context is or how to use it on background threads, and I haven't found any good examples on it. Any help? Here is an excerpt of what I'm trying to do: public class GeoCode extends AsyncTask<GeoThread, Void, GeoThread> { @Override protected GeoThread doInBackground(GeoThread... i) { List<Address> addresses = null; Geocoder geoCode = null; geoCode = new Geocoder(null); //Expects at minimum Geocoder(Context context); addresses = geoCode.getFromLocation(GoldenHour.lat, GoldenHour.lng, 1); } } It keeps failing at the sixth line there, because of the improper Context.

    Read the article

  • Add a parameter to a google maps geocoder funcion

    - by kree
    I want to create a geocoder function, which write the result to it's parameter. function geoCode(latlng,div) { gc.geocode({'latLng': latlng}, function (result, status) { if (status == google.maps.GeocoderStatus.OK) { new google.maps.Marker({ position: result[0].geometry.location, map: map }); jq(div).html(result[0].formatted_address); } }); How can I add the div parameter to the geocoder function? Any help would be appreciated.

    Read the article

  • AJAX Callback and Javascript class variables assignments

    - by Gianluca
    I am trying to build a little javascript class for geocoding addresses trough Google Maps API. I am learning Javascript and AJAX and I still can't figure out how can I initialize class variables trough a callback: // Here is the Location class, it takes an address and // initialize a GClientGeocoder. this.coord[] is where we'll store lat/lng function Location(address) { this.geo = new GClientGeocoder(); this.address = address; this.coord = []; } // This is the geoCode function, it geocodes object.address and // need a callback to handle the response from Google Location.prototype.geoCode = function(geoCallback) { this.geo.getLocations(this.address, geoCallback); } // Here we go: the callback. // I made it a member of the class so it would be able // to handle class variable like coord[]. Obviously it don't work. Location.prototype.geoCallback = function(result) { this.coord[0] = result.Placemark[0].Point.coordinates[1]; this.coord[1] = result.Placemark[0].Point.coordinates[0]; window.alert("Callback lat: " + this.coord[0] + "; lon: " + this.coord[1]); } // Main function initialize() { var Place = new Location("Tokyo, Japan"); Place.geoCode(Place.geoCallback); window.alert("Main lat: " + Place.coord[0] + " lon: " + Place.coord[1]); } google.setOnLoadCallback(initialize); Thank you for helping me out!

    Read the article

  • Parsing JSON file with Python -> google map api

    - by Hannes
    Hi all, I am trying to get started with JSON in Python, but it seems that I misunderstand something in the JSON concept. I followed the google api example, which works fine. But when I change the code to a lower level in the JSON response (as shown below, where I try to get access to the location), I get the following error message for code below: Traceback (most recent call last): File "geoCode.py", line 11, in test = json.dumps([s['location'] for s in jsonResponse['results']], indent=3) KeyError: 'location' How can I get access to lower information level in the JSON file in python? Do I have to go to a higher level and search the result string? That seems very weird to me? Here is the code I have tried to run: import urllib, json URL2 = "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false" googleResponse = urllib.urlopen(URL2); jsonResponse = json.loads(googleResponse.read()) test = json.dumps([s['location'] for s in jsonResponse['results']], indent=3) print test Thank you for your responses.

    Read the article

  • Adding ID's to google map markers

    - by Nick
    I have a script that loops and adds markers one at a time. I am trying to get the current marker to have an info window and and only have 5 markers on a map at a time (4 without info windows and 1 with) How would i add an id to each marker so that i can delete and close info windows as needed. this is the function i am using to set the marker function codeAddress(address, contentString) { var infowindow = new google.maps.InfoWindow({ content: contentString }); if (geocoder) { geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); infowindow.open(map,marker); } else { alert("Geocode was not successful for the following reason: " + status); } }); } }

    Read the article

  • Google Map API V3 geocoder not showing the correct place

    - by TTCG
    I am upgrading my codes from Google Map API V2 to V3. In V2, I used GlocalSearch to get the latitude and longitude for the given address. In V3, I saw google.maps.Geocoder() and try to get the similar detail. However, the lat & long given by the V3 function is not accurate. Pls see the following screenshot here: My codes for V3 are as follow: var geocoder = new google.maps.Geocoder(); function codeAddress(address) { if (geocoder) { address = address + ", UK"; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var latlng = results[0].geometry.location; addMarker(latlng); //Adding Marker here } else { alert("Geocode was not successful for the following reason: " + status); } }); } } Is there better way to get the accurate result in API V3? Thanks.

    Read the article

  • Django: Geocoding an address on form submission?

    - by User
    Trying to wrap my head around django forms and the django way of doing things. I want to create a basic web form that allows a user to input an address and have that address geocoded and saved to a database. I created a Location model: class Location(models.Model): address = models.CharField(max_length=200) city = models.CharField(max_length=100) state = models.CharField(max_length=100, null=True) postal_code = models.CharField(max_length=100, null=True) country = models.CharField(max_length=100) latitude = models.DecimalField(max_digits=18, decimal_places=10, null=True) longitude = models.DecimalField(max_digits=18, decimal_places=10, null=True) And defined a form: class LocationForm(forms.ModelForm): class Meta: model = models.Location exclude = ('latitude','longitude') In my view I'm using form.save() to save the form. This works and saves an address to the database. I created a module to geocode an address. I'm not sure what the django way of doing things is, but I guess in my view, before I save the form, I need to geocode the address and set the lat and long. How do I set the latitude and longitude before saving?

    Read the article

  • How to import this data set into excel? (column headings on each row delimited by a colon)

    - by Anonymous
    I'm trying to import the following data set into Excel. I've had no luck with the text import wizard. I'd like Excel to make id, name, street, etc the column names and insert each record onto a new row. , id: sdfg:435-345, name: Some Name, type: , street: Address Line 1, Some Place, postalcode: DN2 5FF, city: Cityhere, telephoneNumber: 01234 567890, mobileNumber: 01234 567890, faxNumber: /, url: http://www.website.co.uk, email: [email protected], remark: , geocode: 526.2456;-0.8520, category: some, more, info , id: sdfg:435-345f, name: Some Name, type: , street: Address Line 1, Some Place, postalcode: DN2 5FF, city: Cityhere, telephoneNumber: 01234 567890, mobileNumber: 01234 567890, faxNumber: /, url: http://www.website.co.uk, email: [email protected], remark: , geocode: 526.2456;-0.8520, category: some, more, info Is there any easy way to do this with Excel? I'm struggling to think of a way to convert this to a conventional CSV easily. As far as I can think, I'd have to remove the labels from each line, enclose each line in quotes, then delimit them with commas. Obviously that's made a little more difficult to script though seeing as some fields (address, for instance) contain comma-delimited data. I'm not good with regex at all. What's the best way to tackle this?

    Read the article

  • Loading city/state from SQL Server to Google Maps?

    - by knawlejj
    I'm trying to make a small application that takes a city & state and geocodes that address to a lat/long location. Right now I am utilizing Google Map's API, ColdFusion, and SQL Server. Basically the city and state fields are in a database table and I want to take those locations and get marker put on a Google Map showing where they are. This is my code to do the geocoding, and viewing the source of the page shows that it is correctly looping through my query and placing a location ("Omaha, NE") in the address field, but no marker, or map for that matter, is showing up on the page: function codeAddress() { <cfloop query="GetLocations"> var address = document.getElementById(<cfoutput>#Trim(hometown)#,#Trim(state)#</cfoutput>).value; if (geocoder) { geocoder.geocode( {<cfoutput>#Trim(hometown)#,#Trim(state)#</cfoutput>: address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, title: <cfoutput>#Trim(hometown)#,#Trim(state)#</cfoutput> }); } else { alert("Geocode was not successful for the following reason: " + status); } }); } </cfloop> } And here is the code to initialize the map: var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(42.4167,-90.4290); var myOptions = { zoom: 5, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var marker = new google.maps.Marker({ position: latlng, map: map, title: "Test" }); map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } I do have a map working that uses lat/long that was hard coded into the database table, but I want to be able to just use the city/state and convert that to a lat/long. Any suggestions or direction? Storing the lat/long in the database is also possible, but I don't know how to do that within SQL.

    Read the article

  • How do I return a variable in javascript?

    - by bmckim
    I am working with the google maps API and whenever I return the variable to the initialize function from the codeLatLng function it claims undefined. If I print the variable from the codeLatLng it shows up fine. var geocoder; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(40.730885,-73.997383); var addr = codeLatLng(); document.write(addr); } function codeLatLng() { var latlng = new google.maps.LatLng(40.730885,-73.997383); if (geocoder) { geocoder.geocode({'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { return results[1].formatted_address; } else { alert("No results found"); } } else { alert("Geocoder failed due to: " + status); } }); } } prints out undefined If I do: var geocoder; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(40.730885,-73.997383); codeLatLng(); } function codeLatLng() { var latlng = new google.maps.LatLng(40.730885,-73.997383); if (geocoder) { geocoder.geocode({'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { document.write(results[1].formatted_address); } else { alert("No results found"); } } else { alert("Geocoder failed due to: " + status); } }); } } prints out New York, NY 10012, USA

    Read the article

  • GUnload is null or undefined using Directions Service

    - by user1677756
    I'm getting an error using Google Maps API V3 that I don't understand. My initial map displays just fine, but when I try to get directions, I get the following two errors: Error: The value of the property 'GUnload' is null or undefined, not a Function object Error: Unable to get value of the property 'setDirections': object is null or undefined I'm not using GUnload anywhere, so I don't understand why I'm getting that error. As far as the second error is concerned, it's as if something is wrong with the Directions service. Here is my code: var directionsDisplay; var directionsService = new google.maps.DirectionsService(); var map; function initialize(address) { directionsDisplay = new google.maps.DirectionsRenderer(); var geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(42.733963, -84.565501); var mapOptions = { center: latlng, zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { alert("Geocode was not successful for the following reason: " + status); } }); directionsDisplay.setMap(map); } function getDirections(start, end) { var request = { origin:start, destination:end, travelMode: google.maps.TravelMode.DRIVING }; directionsService.route(request, function(result, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(result); } else { alert("Directions cannot be displayed for the following reason: " + status); } }); } I'm not very savvy with javascript, so I could have made some sort of error there. I appreciate any help I can get.

    Read the article

  • How can I make my Google Maps api v3 address search bar work by hitting the enter button on the keyboard?

    - by Gavin
    I'm developing a webpage and I would just like to make something more user friendly. I have a functional Google Maps api v3 and an address search bar. Currently, I have to use the mouse to select search to initialize the geocoding function. How can I make the map return a placemark by hitting the enter button on my keyboard? I just want to make it as user-friendly as possible. Here is the javascript and div, respectively, I created for the address bar: var geocoder; function initialize() { geocoder = new google.maps.Geocoder (); function codeAddress () { var address = document.getElementById ("address").value; geocoder.geocode ( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results [0].geometry.location); marker.setPosition(results [0].geometry.location); map.setZoom(14); } else { alert("Geocode was not successful for the following reason: " + status); } }); } <div id="geocoder"> <input id="address" type="textbox" value=""> <input type="button" value="Search" onclick="codeAddress()"> </div> Thank you in advance for your help

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >