Example #1
0
        /// <summary>
        /// Point from WK.
        /// </summary>
        /// <returns>The Point</returns>
        /// <param name="wkt">WKT.</param>
        static GeoPoint WktToPoint(string wkt)
        {
            string[] values;
            values = wkt.Trim('(', ')').Split(' ');
            string z      = (values.Length > 2 ? values[2] : null);
            var    geopos = new GeoEntity(values[0], values[1], z);

            return(new GeoPoint(geopos));
        }
Example #2
0
        /// <summary>
        /// GeoLineString from WK.
        /// </summary>
        /// <returns>The GeoLineString</returns>
        /// <param name="wkt">WKT.</param>
        static GeoLineString WktToLineString(string wkt)
        {
            string[]          terms = wkt.Split(',');
            string[]          values;
            List <IGeoEntity> positions = new List <IGeoEntity>(terms.Length);

            for (int i = 0; i < terms.Length; i++)
            {
                values = terms[i].Split(' ');
                string z      = (values.Length > 2 ? values[2] : null);
                var    geopos = new GeoEntity(values[1], values[0], z);
                positions.Add(geopos);
            }

            GeoLineString test = new GeoLineString(positions);

            return(test);
        }