0

I draw into mapControl a polygon and I have another geopoint(47.0025462722356, 28.7778985977174) this is into this polygon. how to create a function that return if a GeoPoint is into a polygon or not? Thank you a lot

        private void DrawPolygon()
        {
            VectorItemsLayer layer = VectorItemsLayer)this.mapControl.Layers[1];
            MapItemStorage ItemStorage = (MapItemStorage)layer.Data;
            var path = new MapPath();
            var segment = new MapPathSegment();
            segment.Points.AddRange(new GeoPoint[]
            {
                new GeoPoint(47.000751662342765, 28.782015716126669),
                new GeoPoint(47.003499105949331, 28.779784489235578),
                new GeoPoint(47.005060446204077, 28.776670571833844),
                new GeoPoint(47.002626050570065, 28.774355254904908),
                new GeoPoint(47.000264065129222, 28.779487220183803),
                new GeoPoint(47.000751662342765, 28.782015716126669)
            });
            path.Segments.Add(segment);
            ItemStorage.Items.Add(path);
        }
TaW
  • 53,122
  • 8
  • 69
  • 111
Silvia Parfeni
  • 518
  • 1
  • 6
  • 17
  • 3
    Have you even tried *anything*? Your question is far too broad and complex - in particular if your polygons may have holes or self-intersections. Anyway you may simply draw a line from your point to the polygons centroid and count the number of intersections of that line with the polygons border. If this number os even then your point is outside, otherwise its inside your polygon. – MakePeaceGreatAgain Nov 18 '16 at 10:56
  • It is a closed polygon – Silvia Parfeni Nov 18 '16 at 10:58
  • That wasn´t the question, I assume your polygon is closed - otherwise I´d call it a path or just a line or similar. – MakePeaceGreatAgain Nov 18 '16 at 10:59
  • there are a possibility to determine if a geopoint is into a polygon, this is the question – Silvia Parfeni Nov 18 '16 at 11:03
  • The example provided in the [How to check if a Point is inside a Polygon using the Ray Casting algorithm](https://www.devexpress.com/Support/Center/Example/Details/T425356) DevExpress support center ticket is for the WPF MapControl but will work on the WinForms control as well, since they share a common architecture. – Brendon Nov 18 '16 at 16:10

0 Answers0