Click to search on your search term.
Subscribe to Fig Leaf Tutorials

Need help with a project? Contact us at
From code reviews to project "jumpstarts" and full life-cycle development, we've got you covered!
Check out our case studies!
Follow us on Twitter!
Click here to join our Facebook group!

Ready to upgrade your skills? Try these instructor-led classes in Washington, DC:

Exercise 2-9a: Geocoding Addresses

Page of 168


During this lab, you will load the Google Maps API and invoke its methods to geocode street addresses.

  • Load the Google Maps API
  • Interactively call the Google Geocoding Service


Load the Google Maps API

  1. Open Sencha Architect
  2. Open the following project:

    Note: This is the solution from the prior exercise.
  3. From the Toolbox, drag the Google Maps API component and drop it onto the Resources category of the Project Inspctor.
Geocode a Street Address
  1. In the Project Inspector, click on Views > Main > Friends > friendForm> buttonContainer > btnGeoCode
  2. In the Config panel, click on the [+] adjacent to Event Bindings and select Basic Event Binding.
  3. Choose tap from the select list.
  4. In the Project Inspector, right-click on the onBtnGeoCodeTap event handler and select Convert to Action > Friends
  5. Click on the Code button
  6. Enter the following code to geocode the street address in the form and place the results into the lat and lng fields:
 message:'Geocoding, Please Wait...'

// get pointer to form
var formPanel =  this.getFriendForm();

// get all form values
var formvalues = formPanel.getValues();

// geocode street address + zip
var address = formvalues.address + " " +;
var geocoder = new google.maps.Geocoder();

geocoder.geocode({ 'address': address }, function(results, status) {
 if (status == "OK") {
 } else {
  Ext.Msg.alert("Geocoding failed","Please check the address");
  1. Click Save
  2. Click Preview
  3. Test your application by adding a new contact and pressing the Geo button at the bottom of the form.

-- End of Exercise --

Page of 168
comments powered by Disqus