/// <summary> /// Gets a binary representation of the feature geometry. /// </summary> /// <param name="feature">Feature</param> protected byte[] SpatialDataBytesFromFeature(Feature feature) { using (MemoryStream ms = new MemoryStream()) { BinaryGeometrySerializer.SerializeGeometry(ms, feature.Geometry); return(ms.ToArray()); } throw new NotSupportedException("Feature type \"" + feature.FeatureType.ToString() + "\" is not supported."); }
/// <summary> /// Construct a feature from its binary representation. /// </summary> /// <param name="bytes">Byte array that contains binary representation of feature geometry</param> protected Feature FeatureFromSpatialDataBytes(byte[] bytes) { Feature feature = null; using (MemoryStream ms = new MemoryStream(bytes)) { IGeometry geometry = BinaryGeometrySerializer.DeserializeGeometry(ms); feature = new Feature(geometry); } return(feature); }