BookmarkSubscribeRSS Feed
zephstemle
SAS Employee

The Tracking the International Space Station, an Introduction to Geofences ESP example is a fun way to learn how a geofence works. In this example you will get an introduction to the Geofence window including:

 

  • How to define areas of interest for a geofence
  • How to use the geofence window to detect a position within a circle
  • How to use position proximity analysis to detect a position’s proximity to a polygon
  • How to create a GEO Map in SAS ESP Streamviewer

 

International Space Station

 

iss2.jpg

 

The International Space Station (ISS) is a modular space station in low Earth orbit. It maintains an altitude of 251 miles and completes an orbit of the Earth in about 93 minutes. The ISS makes 15.54 orbits per day and is travelling at 7.66 km/s (27,600 km/h; 17,100 mph). The API used by this project publishes the latitude and longitude of the ISS every 10 seconds.

 

Geofence Overview

 

A geofence is a virtual perimeter for a real-world geographic area. The geofence can be defined in one of three ways:

 

  • Set of coordinates with a radius (circle)
  • Multiple sets of coordinates defining a bounding box (polygon)
  • Multiple sets of coordinates defining a trip wire (polyline)

This example demonstrates the use of circles and ploygons to define areas of interest.

 

geofence.png

 

A geofence window requires two data sources as input. The position source window streams the geographic positions of one or more objects. The geometries source window provides definitions for areas of interest (geometries).

 

The geofence window functions like an outer join. When the coordinates for an event from the position source window is inside the definition of an area of interest, an output event is generated.

 

Circles

 

You use a set of coordinates and a radius to define a circle around an area of interest. You can use Cartesian (X,Y) or geographic (lat,long) coordinates. The radius is specified in meters.

 

The following are examples of circle definitions:

 

ID,Name,Lat,Long,Radius

1,Eiffel Tower,48.8584,2.2945,1500000

2,Colosseum,41.8902,12.4922,1750000

3,Statue of Liberty,40.6892,-74.0445,1500000

 

If the position of an object is outside the circle, the geofence window will not generate an output event. However, if the position is within the radius of the circle, an output event is created and the distance to the center of the circle is calculated.

 

in_out_radius.png

 

Polygon

You can also define a bounding box or polygon as your area of interest. A polygon is defined as multiple sets of coordinates that from a closed ring. This is done by using the same set of coordinates for the first and last entry of a definition.

 

Since each polygon will probably have a different number of coordinate sets, a single field can be used to specify all sets of coordinates. This field is referred to as datadef and is a string using spaces as delimiters.

 

The following is an example of a polygon definition.

 

ID,Name,Datadef

1,Poly1, “5.281 9.455 3.607 7.112 6.268 6.181 8.414 7.705 5.281 9.455 “

 

During normal operation, the geofence window outputs an event when the object is within the confines of the polygon. If the object is outside the polygon, no output event is generated.

 

in_out_polygon.png

 

Position Proximity Analysis

 

Position proximity analysis is an option that determines the proximity of an object to the closest segment of the polygon. When position proximity analysis is set to true, the geofence window outputs an event when the object is either inside the polygon, or within the radius defined as the proximity.

 

If the object is inside the proximity radius, the distance to the nearest polygon segment is calculated and output as a positive number. If the object is inside the polygon, the distance to the nearest polygon segment is again calculated, but output as a negative number.

 

proximity.png

 

GEO Maps

 

The following GEO Maps were created using SAS ESP Streamviewer. The first example shows a GEO Map subscribed to the iss Source window. It is a simple display of the current latitude and longitude of the ISS.

 

iss.png

 

This next example shows a GEO Map subscribed to a Geofence window using circles as the geometry. The distance to the center point of the circle is illustrated by both the color and size of the circles. The ISS is crossing Abuja, Nigeria. The circle displayed goes form orange to cyan and gets smaller as the ISS approaches. It turns from cyan to orange and gets larger as the ISS departs.

 

geocircle.png

 

This last example shows a GEO Map subscribed to a Geofence window performing position proximity analysis. The ISS has just left Russia and is crossing Mongolia into China. The orange circle represents the proximity to Russia getting further away, while the cyan circle represents the proximity to China.

 

geoprox.png

 

Summary

 

The Tracking the ISS, an Introduction to Geofences ESP example show you several ways to use the Geofence window to track an object. Refer to the GitHub page for this example to get additional information.

Whether you're already using SAS Event Stream Processing or thinking about it, this is where you can connect with your peers, ask questions and find resources.

 

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 0 replies
  • 2479 views
  • 3 likes
  • 1 in conversation