Search Results

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

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

  • Google Maps API Geocode gives error "Invalid label" in Firefox

    - by Bennystijn
    Today I struggled with the following: $.ajax({url:'http://maps.google.com/maps/api/geocode/jsonaddress=Karachi&sensor=false&output=json&callback=?', dataType: 'json', success: function(data){ //eval("("+data+")"); alert(data); } }); Firefox gives the error "Invalid Label" and Chrome "Uncaught SyntaxError: Unexpected token :". I found a lot of posts about this, and I tried all kinds of things like eval(), but also: $.getJSON('http://maps.google.com/maps/api/geocode/jsonaddress=Karachi&sensor=false&output=json&callback=?', function(data){ //eval("("+data+")"); alert(data); } ); Same result. Also, other json data works fine, for instance flickr ("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?). So it has something to do with the Google Maps API output i guess.. Thanks in advance.

    Read the article

  • Querying a perimeter around a Geocode-Location (Lat/Lon)

    - by Tim
    Hi, how can I search for geo-objects in a certain perimeter ? E.g. I have several objects with Lat/Lon coordinates stored in my DB. Now I want to retrieve all the objects which lie in a specific perimeter (10 miles or 20 miles) around a given point. I guess what I would have to do is to form some query like: SELECT * FROM objects o where o.lat < (myPositionLat+x) AND o.lon < (myPositionLon+y) Is this right? How do I determine/set the values for x and y?

    Read the article

  • Webservices error for dev.virtualearth.net/webservices/geocode

    - by Xaisoft
    I am getting the following stacktrace and have no idea what I am looking at and how to debug and fix it: Here is the error: Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Reference.svcmap: Failed to generate code for the service reference 'GeocodeService'. Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Could not load file or assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified. XPath to Error Source: //wsdl:definitions[@targetNamespace='http//dev.virtualearth.net /webservices/v1/geocode/contracts']/wsdl:portType[@name='IGeocodeService'] Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http: //dev.virtualearth.net/webservices/v1/geocode/contracts'] /wsdl:portType[@name='IGeocodeService'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http: //dev.virtualearth.net /webservices/v1/geocode']/wsdl:binding[@name='BasicHttpBinding_IGeocodeService'] Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://dev.virtualearth.net /webservices/v1/geocode']/wsdl:binding[@name='BasicHttpBinding_IGeocodeService'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://dev.virtualearth.net /webservices/v1/geocode']/wsdl:service[@name='GeocodeService'] /wsdl:port[@name='BasicHttpBinding_IGeocodeService'] Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http: //dev.virtualearth.net/webservices/v1/geocode/contracts'] /wsdl:portType[@name='IGeocodeService'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http: //dev.virtualearth.net /webservices/v1/geocode']/wsdl:binding[@name='CustomBinding_IGeocodeService'] Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://dev.virtualearth.net /webservices/v1/geocode']/wsdl:binding[@name='CustomBinding_IGeocodeService'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://dev.virtualearth.net /webservices/v1/geocode']/wsdl:service[@name='GeocodeService'] /wsdl:port[@name='CustomBinding_IGeocodeService']

    Read the article

  • geocode webservice address parameter written in another language

    - by nicholas
    Dear fellow Programmers, I try to use the following google map webservice in order to locate greek addresses: http://maps.google.com/maps/api/geocode/json?address=??ad?µ?a? 16&sensor=false and it does not work. If I hit the same exactly address but written with latin alphabet characters: maps.google.com/maps/api/geocode/json?address=akadimias 16&sensor=false, it works and returns the right result. Could somebody help with this? (To use this service with greek letters as language parameter) Thank you in advance, Nicholas

    Read the article

  • Rails Gem Install Problems: Google-Geocode

    - by spin-docta
    I'm try to install google-geocode for rails sudo gem install google-geocode but I get the following error. Any suggestions? Building native extensions. This could take a while... ERROR: Error installing google-geocode: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for xmlParseDoc() in -lxml2... no libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-iconv-dir --without-iconv-dir --with-iconv-include --without-iconv-include=${iconv-dir}/include --with-iconv-lib --without-iconv-lib=${iconv-dir}/lib --with-xml2-dir --without-xml2-dir --with-xml2-include --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib --with-xslt-dir --without-xslt-dir --with-xslt-include --without-xslt-include=${xslt-dir}/include --with-xslt-lib --without-xslt-lib=${xslt-dir}/lib --with-xml2lib --without-xml2lib Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.0 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.0/ext/nokogiri/gem_make.out

    Read the article

  • Google Maps - Reserve Geocode -> Error "invalid label"

    - by Newbie
    Hello! I have the coordinates of my marker. Now I want to get the address of the marker. So I searched the web and found google maps reserve geocode. Now I tried to do the following: $.getJSON('http://maps.google.com/maps/api/geocode/json?latlng='+point.lat()+','+ point.lng() +'&key='+apiKey+'&sensor=false&output=json&callback=?', function(data) { console.log(data); }); When I try to show the address, meaning getting the json, firebug throws the following error: invalid label on "status": "OK",\n I searched a lot, but didn't find an answer solving my problem. Can you tell me whats wrong with my code? Is there another way to get the address data for the coordinates?

    Read the article

  • Geocode multiple addresses

    - by ace2600
    I need to geocode around 200 addresses per request and do around 3,000 request per day. I will be doing this server side using PHP. I have looked at http://stackoverflow.com/questions/98449/how-to-convert-an-address-to-a-latlon, but could not find a way for either Google Maps HTTP Request API or the Yahoo Geocoding REST API (cannot use JavaScript as this is server side) to send multiple addresses. I will be primarily using this to sort addresses based on the coordinates and if the API supports, fill in any missing data for each address. The addresses will be in the United States only. The addresses to geocode will be from user input, so be free form, like "street address, postal code", or "city, state", etc. Accuracy is not too important for the coordinates, say within five hundred feet or so. Is there a free API to handle this? Is there a way to get Yahoo or Google to do multiple locations in a request?

    Read the article

  • Strange Google Maps v3 geocode behavior when a quote is in the address

    - by AlexV
    See my test page. When on the page, click the top left button "Geocode". If you are in Firefox, geocoder.geocode() will have it's status equal to ERROR (and pop an alert after a few seconds). In Internet Explorer (at least 7), everything is fine and the marker is added to the map. If you remove the quote from the address (l'Assomption -- lAssomption), everything execute fine in Firefox. Now with my question: how a quote can "crash" the Google Maps V3 API only in Firefox!?

    Read the article

  • C# Stream Reader adding \n to XML

    - by Terry
    I use the StreamReader class to obtain XML for my GeoCoding process from Google. StreamReader srGeoCode = new StreamReader(WebRequest.Create(Url).GetResponse().GetResponseStream()); String GeoCodeXml = srGeoCode.ReadToEnd(); XmlDocument XmlDoc = new XmlDocument(); GeoCode oGeoCode = new GeoCode(); XmlDoc.Load(GeoCodeXml); I get XML back but it adds \n and other extras to the XML <?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<kml xmlns=\"http://earth.google.com/kml/2.0\"><Response>\n <name> I have the same code in VB and it does not do this. I can successfully GeoCode my information using the VB version of this console app. Is there a reason the C# version adds this extra data to the XML that I retrieve back? I am trying my best to convert everything over to C#. I enjoy coding in it over VB.

    Read the article

  • How to geocode a large number of addresses?

    - by user308569
    I need to geocode, i.e. translate street address to latitude,longitude for ~8,000 street addresses. I am using both Yahoo and Google geocoding engines at http://www.gpsvisualizer.com/geocoder/, and found out that for a large number of addresses those engines (one of them or both) either could not perform geocoding (i.e.return latitude=0,longitude=0), or return the wrong coordinates (incl. cases when Yahoo and Google give different results). What is the best way to handle this problem? Which engine is (usually) more accurate? I would appreciate any thoughts, suggestions, ideas from people who had previous experience with this kind of task.

    Read the article

  • Reverse geocode without using MKReverseGeocoder

    - by SpH1nX
    Hi guys, I'm trying to detect current user address using MKReverseGeocoder passing coordinates obtained via CLLocation class. Reading MKReverseGeocoder Class Reference I noticed that The Google terms of service require that the reverse geocoding service be used in conjunction with a Google map; take this into account when designing your application's user interface. so I'm wondering if (and eventually how) can I reverse geocode user current location on iPhone OS SDK 3.1.3. I thought using Google Maps API but the EULA has the same obligation. Yahoo Maps API is even worse and Microsoft one aren't free.

    Read the article

  • can't load/read yahoo geocode as xml and read it in jquery

    - by mastah
    Hi, I tried saving the result as an xml, when I read from there it works, but if I read it from yahoo's api, doesn't load anything. You can check it here here's my script $(document).ready(function(){ $.ajax({ type: "GET", url: "http://local.yahooapis.com/MapsService/V1/geocode?appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--&zip=10035", dataType: "xml", success: function(xml) { $(xml).find('Result').each(function(){ var city = $(this).find('City').text(); var state = $(this).find('State').text(); $('<div />').html('<p>'+city+'</p><p>'+state+'</p>').insertAfter('h2'); }); } }); });

    Read the article

  • Obfuscating Geocode results to protect privacy?

    - by Kevin
    I have an app that finds other users within a 20 mile radius on a google map and associates an icon with each of them. However, I do not want their exact points to be given but rather an approximation. I've wrestled with a few ideas on how to do this: Only Geocode the Zip Code, make graphic icons for 1-99, use the icon to represent how many results are within the zip code, and use the info window to show hyperlinks to the individual results. The only problem is, I'd like each individual icon to be shown because it just looks a lot better. Add/Subtract a random number to the lat/lng values stored with each user and add a translucent circle around the icon. What do you guys suggest?

    Read the article

  • Reverse geocode street name and city as text

    - by Taylor Satula
    Hello, I have been having some trouble finding a good way to output just the street name and city as text (Infinite Loop, Cupertino shown here) that can be displayed in my iPhone app. This needs to be able to dynamically change as you change streets and city. I don't have the slightest idea of how to do this, I hope someone can help. I have attached a very rough image of what I am trying to acheave. I have found this (http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding) for google maps about how to reverse geocode using javascript, but what I do not understand is how this would be done in a iPhone development setting. I work in web design and I see how it would be done in HTML but I am very new to iPhone development and don't have the slightest clue of how it would be done here. If someone could spell out how to do this I would be extremely grateful. I cannot seem to find what I am looking for by searching Google. Reference picture: http://www.threepixeldrift.com/images/deep-storage/reversegeocodeiphoneapp.jpg

    Read the article

  • Showing each step geocode of directions

    - by Puru puru rin..
    Hello, Google Maps API can build a Direction from a source to a destination. In the following Google's example, each step are published into the HTML code: http://code.google.com/apis/maps/documentation/examples/directions-simple.html I would like to get the Geocoding of each step of this direction, and store them in a array. I believe it's possible, but I don't see how to process. Many Thanks for any answer. Regards

    Read the article

  • Google's Geocoder returns wrong country

    - by 6bytes
    Hi I'm using Google's Geocoder to find lat lng coordinates for a given address. var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': address, 'region': 'uk' }, function(results, status) { if(status == google.maps.GeocoderStatus.OK) { lat: results[0].geometry.location.lat(), lng: results[0].geometry.location.lng() }); address variable is taken from an input field. I want to search locations only in UK. I thought that specifying 'region': 'uk' should be enough but it's not. When I type in "Boston" it founds Boston in US and I wanted the one in UK. How to restrict Geocoder to return locations only from one country or maybe from a certain lat lng range? Thanks

    Read the article

  • accessing google maps via UIWebView - illegal?

    - by Karin
    New to iPhone development. Working on first app. I'm accessing google maps via UIWebView to forward geocode an address using "http://maps.google.com/maps?q=my address". It works, although it has this quirk of requiring you to hit "Back" button and then the "Detail" button (provided by the navigation bar) to get back to the screen from whence you started. If anyone knows why it does this, I'd love to hear. My real question, however, is this a legal use of google maps? Since I intend this app for commercial use, am I violating Google's rules + regs? If it is illegal, what's my alternative? Thanks.

    Read the article

  • Flash and Google Maps - Only Last Icon showing

    - by Peter
    I have a simple Map and geocoding sample in Flash using CS4 The problem is simple - I can retrieve a short list from the google search api, but when I try to generate the icons on the map using a loop, only the last icon is displayed. (ignore the house icon, it is generated earlier) I feel I am missing something or made a stupid AS3 mistake (like treating it as if it was c#) - or even a stupid wood-for-the-trees mistake. The problem is in the last line of the code. I have added all my code just in case somebody else can find a use for it - lord knows it took me a great while to figure this out :) It runs here (also, if anybody has an idea why the icon is slightly in the wrong place on render, but corrects if you move the map - please let me know) Any help would be great. Thanks. P import com.google.maps.services.ClientGeocoder; import com.google.maps.services.GeocodingEvent; import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapType; import com.google.maps.overlays.Marker; import com.google.maps.overlays.MarkerOptions; import com.google.maps.styles.FillStyle; import com.google.maps.styles.StrokeStyle; import com.google.maps.controls.* import com.google.maps.overlays.* import flash.display.Bitmap; import flash.display.BitmapData; import com.adobe.utils.StringUtil; import be.boulevart.google.ajaxapi.search.GoogleSearchResult; import be.boulevart.google.events.GoogleApiEvent; import be.boulevart.google.ajaxapi.search.local.GoogleLocalSearch; import be.boulevart.google.ajaxapi.search.local.data.GoogleLocalSearchItem; var strZip:String = new String(); strZip="60661"; var strAddress:String = new String(); strAddress ="100 W. Jackson Blvd, chicago, IL 60661"; var IconArray:Array = new Array; var SearchArray:Array = new Array; /*-------------------------------------------------------------- // The returned search data gets placed into this array ---------------------------------------------------------------*/ var LocalInfo:Array = new Array(); var intCount:int = new int; var intMapReady:int=0; /*=================================================================================== We load the map first and then get the search criteria - this will keep the order of operation clean. The ====================================================================================*/ var map:Map = new Map(); map.key = "ABQIAAAAHwSPp7Lhew456ffD6qa2WmxT_VwdLJEfmcCgytxKjcH1jLKkiihQtfC- TbcwryvBQYhRwHWa8F_Gp9Q"; map.setSize(new Point(600, 550)); map.addEventListener(MapEvent.MAP_READY, onMapReady); //Places the map on the page this.addChild(map); map.x=5; map.y=5; function onMapReady(event:Event):void { //Center the map and place the house marker doGeocode(); } /*========================================================================== Goecode to return the LAT and LONG for the specific address, center the map and add the house icon ===========================================================================*/ function doGeocode() { var geocoder:ClientGeocoder = new ClientGeocoder(); geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, function(event:GeocodingEvent):void { var objPlacemarks:Array = event.response.placemarks; if (objPlacemarks.length > 0) { map.setCenter(objPlacemarks[0].point, 14, MapType.NORMAL_MAP_TYPE); var request:URLRequest = new URLRequest("house.png"); var imageLoader:Loader = new Loader(); imageLoader.load(request); var objMarkerOptions:MarkerOptions = new MarkerOptions(); objMarkerOptions.icon=imageLoader; objMarkerOptions.icon.scaleX=.15; objMarkerOptions.icon.scaleY=.15; objMarkerOptions.iconAlignment = MarkerOptions.ALIGN_HORIZONTAL_CENTER + MarkerOptions.ALIGN_VERTICAL_CENTER; var objMarker:Marker = new Marker(objPlacemarks[0].point, objMarkerOptions); map.addOverlay(objMarker); doLoadSearch() } }); //Failure code - good practice, really geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, function(event:GeocodingEvent):void { txtResult.appendText("Geocoding failed"); }); // generate geocode geocoder.geocode(strAddress); } /*=============================================================== XML Loader - loads icon file and search text pair from xml file =================================================================*/ function doLoadSearch() { var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("config.xml")); function LoadXML(e:Event):void { xmlData = new XML(e.target.data); RetrieveSearch(); } function RetrieveSearch() { //extract the MapData subset var xmlSearch = xmlData.MapData; // push this to an xml list object var xmlChildren:XMLList = xmlSearch.children(); //loop the list and extract the data into an //array of formatted search criteria for each (var Search:XML in xmlChildren) { txtResult.appendText("Searching For: "+Search.Criteria+" Icon=" + Search.Icon+ "Zip=" + strZip +"\r\n\r\n"); //retrieve search criteria loadLocalInfo(Search.Criteria,Search.Icon,strZip); } } } /*================================================================================== Search Functionality - does a google API search and loads the lats and longs required to place the icons on the map - THIS WILL NOT RUN LOCALLY ===================================================================================*/ function loadLocalInfo(strSearch,strIcon,strZip) { var objLocal:GoogleLocalSearch=new GoogleLocalSearch() objLocal.search(strSearch+" "+strZip,0,"0,0","","") objLocal.addEventListener(GoogleApiEvent.LOCAL_SEARCH_RESULT,onSearchComplete) function onSearchComplete(e:GoogleApiEvent):void { var resulta:GoogleSearchResult=e.data as GoogleSearchResult; //------------------------------------------------ // Load the icon for this particular search //------------------------------------------------ var request:URLRequest = new URLRequest(strIcon); var imageLoader:Loader = new Loader(); imageLoader.load(request); //------------------------------------------------------------- // For test purposes txtResult.appendText("Result Count for "+strSearch+" = "+e.data.results.length+"\r\n\r\n"); for each (var result:GoogleLocalSearchItem in e.data.results as Array) { LocalInfo[intCount]=[String(result.title),strIcon,String(result.latitude),String(result.longitude)]; //--------------------------------------- // Pop the icon onto the map //--------------------------------------- var objLatLng:LatLng = new LatLng(parseFloat(result.latitude), parseFloat(result.longitude)); var objMarkerOptions:MarkerOptions = new MarkerOptions(); objMarkerOptions.icon=imageLoader; objMarkerOptions.hasShadow=false; objMarkerOptions.iconAlignment = MarkerOptions.ALIGN_HORIZONTAL_CENTER + MarkerOptions.ALIGN_VERTICAL_CENTER; var objMarker:Marker = new Marker(objLatLng, objMarkerOptions); /********************************************************** *Everything* works to here - I have traced out execution and all variables. It only works on the last item in the array :( ***********************************************************/ map.addOverlay(objMarker); } } }

    Read the article

  • Country/City/state validation

    - by M.M.H.Masud
    I want to do the following things using PHP and jQuery https://www.careerbuilder.com/share/register.aspx?sc_cmp1=JS_LoginASPX_RegNow Steps Select a country from a dropdown list. The city dropdown list will fillup automatically with the list of cities of the selected country. If state is available for that country then state list will be visible with all state list of that country. Then I need to validate the selected city, state and country. Do you have any ideas? Thanks in advance

    Read the article

  • Geocoder error when using getFromLocation

    - by Ally
    I'm trying to get the current address based on long/lat. I have the following: Geocoder geocoder = new Geocoder(this); List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); However, I get an error: no feature in GLocation I don't believe this is a permission problem.

    Read the article

  • google maps export driving directions to kml file - java geogoogle

    - by maiky
    Hi Sorry at first for my poor grammar. I am writing a program in Java using geogoogle (Google Geocoder Java API) http://geo-google.sourceforge.net/ I need from two specific points to get the walking directions between these points and also these info to be exported in a KML file. Do you know how can I do it from Java? Is there an API that I can use? Perhaps making a call from the java program to google and handle the result - but how can it be done? Thanks in advance. PS. Google gives this functionality as i saw here http://www.gringod.com/2008/02/26/save-google-maps-driving-directions/ but I need all these to be called from Java.

    Read the article

  • Getting value of "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

1 2 3 4 5  | Next Page >