Geometric relationships in ArcGIS Mobile

Geometric relationships are one of the key fundamentals of GIS. After knowing where and what something (a feature) is, knowing what it is near is critical. While the ArcGIS Mobile system does not provide the functionality to do geoprocessing tasks, like finding all the overlapping features in a layer, you have the ability to do it for a single feature. The geometric relationships are used as part of the QueryFilter to extract the proper features from the selected layer.

The code below shows how to create a QueryFilter and set the relationship type.

if(listBox3.SelectedItem.Equals(GeometricRelationshipType.Any))
  m_filter = new QueryFilter(m_layer.Geometry,GeometricRelationshipType.Any); 
if (listBox3.SelectedItem.Equals(GeometricRelationshipType.Contain))
  m_filter = new QueryFilter(m_layer.Geometry, GeometricRelationshipType.Contain);
if(listBox3.SelectedItem.Equals(GeometricRelationshipType.Cross))
  m_filter = new QueryFilter(m_layer.Geometry,GeometricRelationshipType.Cross);
if(listBox3.SelectedItem.Equals(GeometricRelationshipType.Disjoint))
  m_filter = new QueryFilter(m_layer.Geometry,GeometricRelationshipType.Disjoint);
if (listBox3.SelectedItem.Equals(GeometricRelationshipType.Intersect))
  m_filter = new QueryFilter(m_layer.Geometry, GeometricRelationshipType.Intersect);
if (listBox3.SelectedItem.Equals(GeometricRelationshipType.Overlap))
  m_filter = new QueryFilter(m_layer.Geometry, GeometricRelationshipType.Overlap);
if (listBox3.SelectedItem.Equals(GeometricRelationshipType.Touch))
  m_filter = new QueryFilter(m_layer.Geometry, GeometricRelationshipType.Touch);
if(listBox3.SelectedItem.Equals(GeometricRelationshipType.Within))
  m_filter = new QueryFilter(m_layer.Geometry, GeometricRelationshipType.Within);

The following code shows an example of the created QueryFilter using a geometry sketched on the screen with the relationship selected.

FeatureDataTable m_table = mobileCache1.FeatureSources[listBox1.SelectedIndex].GetDataTable(m_filter);
      dataGridView1.DataSource = m_table;

Where to get the sample

The sample is available for download from ArcGIS Online.

1/7/2015