This project has moved. For the latest updates, please go here.

Programmatically adding geometry

Topics: General Topics, WinForms Controls
Apr 10, 2015 at 11:31 PM
My goal is to map a series of waypoints that describes an intended flight path for a UAV, and a few polygon obstacles. The waypoints and obstacles are currently stored in memory as arrays of objects (c# classes). The waypoint layer is intended to be a series of points connected by lines. The obstacle layer is intended to be a series of unconnected point/radius defined approximately circular polygons.

What would be the best approach to adding geometry to the waypoint layer and an obstacle layer?

What SharpMap.Data.Providers should I use?
Apr 12, 2015 at 5:59 PM
I got the following working for DrawObstacles() now I am working on changing the representation to display obstacle radius.
      private void DrawObstacles(List<Obstacle> obstacles)
            SharpMap.Layers.VectorLayer VectorLayerObstacles
               = new VectorLayer("Obstacles");

            List<IGeometry> geometryList
                = new List<IGeometry>();

                = new NetTopologySuite.NtsGeometryServices();

            IGeometryFactory geometryFactory
                = GeometryServiceProvider.Instance.CreateGeometryFactory();

            foreach (Obstacle obstacle in obstacles)
                IPoint point = geometryFactory.CreatePoint(obstacle.Coordinate);

                = new GeometryProvider(geometryList);


            Envelope envelope = VectorLayerObstacles.Envelope;
Apr 12, 2015 at 8:27 PM
The obstacle radius problem is partially solved using the following:
                NetTopologySuite.Geometries.Point point 
                    = new NetTopologySuite.Geometries.Point(obstacle.Coordinate);

                featureDataRow.Geometry = point.Buffer(.001);
Now all I have to do is somehow convert obstacle radius values in either feet or meters to lat/lon degrees.
Apr 13, 2015 at 8:49 AM
You need to setup a coordinate transformation for you layer, then you can use radius in feet or meter.
If you cannot do that, have a look at