FindServiceSoap.FindPolygon Method

FindServiceSoap.FindPolygon Method

Finds polygons in a specified data source, based on a FindPolygonSpecification object.

Public Function FindPolygon(specification As FindPolygonSpecification) As FindResults

[C#]
public FindResults FindPolygon(FindPolygonSpecification specification);

Parameters

  • specification
    The FindPolygonSpecification object that specifies the polygon data source, the search options to use, the filter used to limit the results, and the spatial filter to use when finding polygons.

Example

[Visual Basic]

'Set up the Address object and the specification object
'Create a FindPolygonSpecification and then call
'the FindPolygon method.

Dim findPolySpec As New FindPolygonSpecification
Dim filter As New LatLongSpatialFilter
filter.LatLong = New LatLong
filter.LatLong.Latitude = Convert.ToDouble(txtLatitude.Text)
filter.LatLong.Longitude = Convert.ToDouble(txtLongitude.Text)

Dim ff As New FindFilter
ff.EntityTypeName = "MyEntityName"

findPolySpec.SpatialFilter = filter
findPolySpec.DataSourceName = "MyDataSource"
findPolySpec.Filter = ff

Dim results As New FindResults
results = finder.FindPolygon(findPolySpec)

If results.NumberFound = 1 Then
   lblCheckPoint.Text = "The specified point is in the polygon."
Else
   lblCheckPoint.Text = "The specified point is not in the polygon."
End If



[C#]

//Create a FindPolygonSpecification and then call
//the FindPolygon method.
FindPolygonSpecification findPolySpec = new FindPolygonSpecification();

LatLongSpatialFilter filter = new LatLongSpatialFilter();
filter.LatLong = new LatLong();
filter.LatLong.Latitude = Convert.ToDouble(txtLatitude.Text);
filter.LatLong.Longitude = Convert.ToDouble(txtLongitude.Text);

FindFilter ff = new FindFilter();
ff.EntityTypeName = "MyEntityName";

findPolySpec.SpatialFilter= filter;
findPolySpec.DataSourceName="MyDataSource";
findPolySpec.Filter = ff;

FindResults results = finder.FindPolygon(findPolySpec);
if (results.NumberFound==1)
{
    lblCheckPoint.Text="The specified point is in the polygon.";
}
else
{
    lblCheckPoint.Text="The specified point is not in the polygon.";
}



See Also

  Working with Polygons   |   FindPolygonSpecification Class