Thanks for your reply. The reason for posting the question was that when I use these routines, they return objects outside of my polygon, equal (I think) to the Location rect.
To explain, I draw the polygon on one layer (background), and use the Poloygon as the parameter to the GetPinPointsInShape(MapShape shape)
method from objects in a RIA collection, using MapLayer.SetLocation(object), but it clearly only returns the items with a boundary which looks like a rectangle with objects outside of the polygon area.
I guess I am using the polygon incorrectly as the parameter. Here is some (not very efficient) test code I used to test...
InformationLayer tempLayer = new InformationLayer();
tempLayer.MapControl = MapControl;
_polygon.Points = GetPolygonPoints(testPolygon); // grabs polygon points from class
foreach (Asset o in _allAssets)
MapPinPoint pp = new MapPinPoint();
pp.Tag = o;
MapLayer.SetLocation(pp, new Location(o.Asset_Lattitude, o.Asset_Longtitude));
var shapes = tempLayer.GetElementsInRectangle(_polygon.GeographicalBounds);
foreach (MapPinPoint item in shapes)
Could you show me an example of say, showing items within a triangle to get me started?
Actually, I would rather only populate with items that fall within the polygon region, rather than add them all to a tempoary layer and then repopulate with a filtered set, as shown above, but this was really just for testing purposes.
Are there any routines that don't involve the UI to perform the calculation, this would be useful for our MVVM pattern, something like pseudo code
List<Locations> LocationsInRegion = Get_Items_In_Region( polygon_region, AllLocations<Locations> )
Apologies if this seems a bit simpleton, but I have not worked with the Map control before and I am still learning its capabilities.