Re: Getting OneSiteData using PolygonBoundary
I've implemented the Web Services on a new site I'm developing and have been attempting to retrieve data which intersects a polygon. I've managed to get it to work for a buffer around a point, but I get the error "The type net.nbnws.www.Point was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically" whenever I try and search using a PolygonBoundary. My code is as follows...
Dim ws As New GatewayWebService()
ws.EnableDecompression = True
Dim req As New OneSiteDataRequest()
req.registrationKey = "0000000000000000000000000000"
Dim gf As New GeographicalFilter()
gf.MinimumResolution = Resolution._1km
gf.MinimumResolutionSpecified = True
Dim CoordsArray() As String
CoordsArray = BufferedRoute.Split(",")
Dim pb As New PolygonBoundary()
Dim coords(UBound(CoordsArray)) As Point
For i As Integer = 0 To UBound(coords)
Dim pt As New Point()
pt.srs = SpatialReferenceSystem.osgb_BNG
pt.x = Math.Round(CInt(CoordsArray(i).Split(" ")(0)))
pt.y = Math.Round(CInt(CoordsArray(i).Split(" ")(1)))
coords(i) = pt
Next
pb.Ring = coords
Dim p As New Polygon()
p.srs = SpatialReferenceSystem.osgb_BNG
p.Boundary = pb
gf.Item = p
req.GeographicalFilter = gf
Dim gd As GatewayData = ws.GetOneSiteData(req)
and that last line is where it fails.
Any advice would be gratefully received.
Thanks,
Tim