Export (0) Print
Expand All

FindServiceSoap.FindPolygon Method

MapPoint Web Service is deprecated and will be retired November 18, 2011. Please go to http://www.microsoft.com/maps/mappoint.aspx for information about upgrading to Bing Maps.

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

[Visual Basic]
Public Function FindPolygon(specification As FindPolygonSpecification) As FindResults
[C#] public FindResults FindPolygon(FindPolygonSpecification 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.


[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."
   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  

© 2014 Microsoft