private Feature Map(FieldBoundary fieldBoundary) { GeoJSON.Net.Geometry.MultiPolygon multiPolygon = MultiPolygonMapper.Map(fieldBoundary.SpatialData, _properties.AffineTransformation); if (multiPolygon == null) { return(null); } Dictionary <string, object> properties = new Dictionary <string, object>(); properties.Add("Guid", UniqueIdMapper.GetUniqueGuid(fieldBoundary.Id, UniqueIdSourceCNH)); if (_properties.Anonymise) { properties.Add("Description", "Field boundary " + fieldBoundary.Id.ReferenceId); } else { properties.Add("Description", fieldBoundary.Description); } // GpsSource var gpsSource = fieldBoundary.GpsSource; properties.Add("GpsSource", null); if (gpsSource != null) { properties["GpsSource"] = fieldBoundary.GpsSource.ToString(); } // Created time var creationTime = fieldBoundary.TimeScopes.Where(ts => ts.DateContext == DateContextEnum.Creation).FirstOrDefault(); properties.Add("CreationTime", null); if (creationTime != null) { if (creationTime.TimeStamp1 != null) { properties["CreationTime"] = ((DateTime)creationTime.TimeStamp1).ToString("O", CultureInfo.InvariantCulture); } } // Modified time var modifiedTime = fieldBoundary.TimeScopes.Where(ts => ts.DateContext == DateContextEnum.Modification).FirstOrDefault(); properties.Add("ModifiedTime", null); if (modifiedTime != null) { if (modifiedTime.TimeStamp1 != null) { properties["ModifiedTime"] = ((DateTime)modifiedTime.TimeStamp1).ToString("O", CultureInfo.InvariantCulture); } } Feature fieldBoundaryDto = new Feature(multiPolygon, properties); return(fieldBoundaryDto); }
public Feature MapAsSingleFeature(DrivenHeadland drivenHeadlandAdapt, Feature fieldBoundary) { GeoJSON.Net.Geometry.MultiPolygon multiPolygon = MultiPolygonMapper.Map(drivenHeadlandAdapt.SpatialData, _properties.AffineTransformation); if (multiPolygon == null) { return(null); } Dictionary <string, object> properties = new Dictionary <string, object>(); if (!String.IsNullOrEmpty(drivenHeadlandAdapt.Description)) { properties.Add("HeadlandDescription", drivenHeadlandAdapt.Description); } foreach (var property in fieldBoundary.Properties) { properties.Add(property.Key, property.Value); } return(new Feature(multiPolygon, properties)); }