A geofence is an area in the real world. It can be either a circle, defined by the center point and radius, or a list of points defining a polygon. You can learn more about how geofences are used in the article on Location-based Services. In this tutorial, you will create a geofence, define a rule which will trigger when an asset is within the geofence, and finally see the rule in operation.
To create the geofence, we will use a Windows application, AssetLinkGeofence, which you can download here. We're going to create a circular geofence centered on Mansfield in Massachusetts, which happens to be close to Axeda Headquarters.

Once you have downloaded the program, open up the directory and run the file AssetLinkGeofence.exe.
Step 1: Connecting to the platform
Click on File -> Connect and enter the email address and password you used when you registered with the developer site.

Step 2: Creating the Geofence
Select the Create item from the Geofences menu:

and a dialog box will appear where you can fill in the details of the geofence to be created. Fill in the first four fields like this:

Press the 'Geocode' button and the system will translate the address into a longitude-latitude pair:

Note that geographic co-ordinates in a geofence are given as longitude and latitude.
Alternatively, you can create a geofence that is not round by putting text into the Geometry text area. The format is called Well-known Text and supports flexible geometries.
Press the 'Create' button, and close the window. You will return to the main window which will now show the geofence you have created:

You can now close this program.
Step 3: Defining an Expression Rule Using the Geofence
Launch and log in to the developer platform. Click on the 'Configuration' tab and select 'Expression Rule' from the 'New' menu. Enter the following values into the form:

An expression rule is applied to one or more models and assets. When one of these assets reports its location, this rule runs. First, it executes the test to see if the reported location is within the "Mansfield" geofence we have defined. If the location is within the geofence, the test succeeds and the 'Then' statement is executed, and an alarm is created with a severity of 100 and the message, "Your asset is within the Mansfield, MA geofence". We haven't specified a statement to be run if the if test fails, but you could do that if you wanted.
So we need to apply the rule we're creating to our asset model, which we'll do by saving the rule and then immediately returning to this screen.
Press the 'Save' button and you'll see a list of expression rules, including the one you just created:

Click on the underlined rule name (i.e., AssetInMansfield) to return to the previous screen, showing the details of this expression rule. Click the pencil and paper icon in the upper left, under Applies To. A form wll open which will allow you to apply the rule to your model (i.e., all the assets in your model):

We'll be done in three clicks: press the magnifying glass icon to list your model; press the 'Add' button to add your model (to the list of models this rule applies to); and press the 'Save' button to save and return to the previous screen, the rule details.
Press 'Save' again to return to the list of expression rules. Make sure that your rule is enabled, and you've completed this step!
Step 4: Test the Expression Rule
To test the expression rule, we'll use both the Get Started Application and the Asset Simulator, just as we did in the Get Started tutorial.
You can start the Asset Simulator by clicking on its image on the lower right of this page. Log in with your usual email and password:

Click on the 'Location' tab and fill in the address: "25 Forbes Blvd, Foxborough, MA". Press the 'Locate' button to translate the address into latitude and longitude co-ordinates:

Press the 'Send' button to send the location to the platform. When the data arrived at the platform, an alarm would have been generated, which we'll see in the next section.
Step 5: Verifying that an alarm was created
On the developer web site, go to Get Started --> Present and start the Get Started application. Log in as usual, and you'll see something like this:

You can see that the asset is where we left it, and in the Alerts box in the lower left you can see the alarm that was created.
You can also see the alarm on the platform UI by going to the 'Service' tab and clicking on 'asset1'.

