Ejemplo n.º 1
0
        private static LevrumPolygon getLevrumPolygon(GeoJSONPolygon input)
        {
            LevrumPolygon output = new LevrumPolygon();

            foreach (LineString lineStr in input.Coordinates)
            {
                foreach (IPosition position in lineStr.Coordinates)
                {
                    output.AddPoint(position.Longitude, position.Latitude);
                }
            }

            return(output);
        }
Ejemplo n.º 2
0
        public static string ConvertPolygonToGeoJSON(LevrumPolygon polygon)
        {
            List <IPosition> positions = new List <IPosition>();

            foreach (Point2 point in polygon.Points)
            {
                positions.Add(new Position(point.Y, point.X));
            }
            LineString        lineStr = new LineString(positions);
            List <LineString> list    = new List <LineString>();

            list.Add(lineStr);
            GeoJSONPolygon poly = new GeoJSONPolygon(list);

            return(JsonConvert.SerializeObject(poly));
        }