Location in Polygon

2 posts, 0 answers
  1. Hans-Joerg
    Hans-Joerg avatar
    1 posts
    Member since:
    Jan 2011

    Posted 19 Jan 2011 Link to this post


    I wonder if there is a possibility to get all objects of an information layer which are contained within a specified polygon (geo coordinates).
    There is a method "InformationLayer.GetElementsInRectangle" wich is almost what we need.

    best regards
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 25 Jan 2011 Link to this post

    Hello Hans-Joerg,

    If polygon is a map shape object is visible over the map, then you can use following method to detect whether specified location is inside the shape:

    private bool IsLocationInShape(MapShape shapeToTest, Location location)
        bool isInShape = false;
        IEnumerable<object> list = this.InformationLayer.GetItemsInLocation(location);
        foreach (object item in list)
            MapShape shape = item as MapShape;
            if (shape != null && shape == shapeToTest)
                isInShape = true;
        return isInShape;

    Then you can loop through the list of the objects and use this method to detect whether the object location is inside the specified shape.

    Best wishes,
    Andrey Murzov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft R3 2016 release webinar banner
Back to Top