Forgot password?
Unexpected error occurred

How to Build an Office Locator

Geo Service has a great feature called user defined places. It allows you to upload your location database and use the search functions against it.

Normally, if you are building an office locator (a function to find nearest stores or offices from a given zip code or city), you have to take zip codes from the results of the proximity function and match it up to your list of office or store addresses.

By allowing Geo Service to manage your address database, you are simplifying the logic. You no longer have to maintain an address database and match up zip codes - all of this is done for you. Call a single function and it returns a list of nearby locations from the addresses that you uploaded.

So let's begin. We assume you already registered and have an account on this site. We are going to build an Apple store locator - see demo here.

  1. Upload your custom locations. You can either use the management webiste or API to do so.
  2. Choose a category that makes sense to you, for this exercise we used "Apple Store". You can upload locations with different categories, which will allow you more than one lists of locations, for example: a bank can upload a list of branches and a list of ATMs.
  3. Write the code to call nearby function with place type set to Apple Store.
    /rest/usa/ca/hollywood/nearby?pt=apple%20store&d=5&apikey=YOURKEY&format=json
  4. Parse the results and display it to the user.
  5. [
        {
            "Address": "8500 Beverly Boulevard",
            "Category": "Apple Store",
            "City": "Los Angeles",
            "Country": "US",
            "Distance": {
                "Unit": "Miles", "Value": 2.5886700996858369
            },
            "Id": "2562183",
            "Lat": 34.073253631591797,
            "Lon": -118.37702941894531,
            "Name": "Beverly Center",
            "PostalCode": "90048",
            "Region": "CA",
            "Type": "UserDefined"
        },
        {
            "Address": "10250 Santa Monica Boulevard",
            "Category": "Apple Store",
            "City": "Los Angeles",
            "Country": "US",
            "Distance": {
                "Unit": "Miles", "Value": 2.668324622980502
            },
            "Id": "2562173",
            "Lat": 34.058124542236328,
            "Lon": -118.41639709472656,
            "Name": "Century City",
            "PostalCode": "90067",
            "Region": "CA",
            "Type": "UserDefined"
        }
    ]