Пример #1
0
        public static void Write(GeoJSON feature, JsonTextWriter writer)
        {
            if (feature == null)
            {
                return;
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer", "A valid JSON writer object is required");
            }

            writer.WriteStartObject();
            writer.WritePropertyName("type");
            writer.WriteValue("Feature");
            writer.WritePropertyName("id");
            string id = GetOrCreateUniqueId(feature.Values);

            writer.WriteValue(id);
            writer.WritePropertyName("properties");
            Write(feature.Values, writer);
            writer.WritePropertyName("geometry_name");
            writer.WriteValue("geometry");
            writer.WritePropertyName("geometry");
            Write(feature.Geometry, writer);
            writer.WriteEndObject();
        }
Пример #2
0
        public static void Write(GeoJSON feature, TextWriter writer)
        {
            if (feature == null)
            {
                return;
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer", "A valid text writer object is required");
            }

            Write(feature, CreateWriter(writer));
        }
Пример #3
0
        /// <summary>
        /// Method to write a GeoJSON feature to the <paramref name="writer"/>
        /// </summary>
        /// <param name="feature">The GeoJSON feature</param>
        /// <param name="writer">The JSON writer</param>
        public static void Write(GeoJSON feature, TextWriter writer)
        {
            if (feature == null)
                return;
            if (writer == null)
                throw new ArgumentNullException("writer", "A valid text writer object is required");

            Write(feature, CreateWriter(writer));
        }
Пример #4
0
 /// <summary>
 /// Method to write a GeoJSON feature to the <paramref name="writer"/>
 /// </summary>
 /// <param name="feature">The GeoJSON feature</param>
 /// <param name="writer">The JSON writer</param>
 public static void Write(GeoJSON feature, JsonTextWriter writer)
 {
     if (feature == null)
         return;
     if (writer == null)
         throw new ArgumentNullException("writer", "A valid JSON writer object is required");
     
     writer.WriteStartObject();
     writer.WritePropertyName("type");
     writer.WriteValue("Feature");
     writer.WritePropertyName("id");
     string id = GetOrCreateUniqueId(feature.Values);
     writer.WriteValue(id);
     writer.WritePropertyName("properties");
     Write(feature.Values, writer);
     writer.WritePropertyName("geometry_name");
     writer.WriteValue("geometry");            
     writer.WritePropertyName("geometry");
     Write(feature.Geometry, writer);
     writer.WriteEndObject();
 }