public static DbGeography ConvertFrom(Microsoft.Spatial.Geography geo) { string geographyEwkt = geo.ToString(); int semicolon = geographyEwkt.IndexOf(';'); string geographyWkt = geographyEwkt.Substring(semicolon + 1); return(DbGeography.FromText(geographyWkt, int.Parse(geo.CoordinateSystem.Id))); }
/// <summary> /// Check for basic equality due to emptyness, nullness, referential equality and difference in coordinate system /// </summary> /// <param name="other">The other geography</param> /// <returns>Boolean value indicating equality, or null to indicate inconclusion</returns> internal bool?BaseEquals(Geography other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (!this.coordinateSystem.Equals(other.coordinateSystem)) { return(false); } if (this.IsEmpty || other.IsEmpty) { return(this.IsEmpty && other.IsEmpty); } return(null); }
/// <summary>Gets the hash code.</summary> /// <returns>The hash code.</returns> public override int GetHashCode() { return(Geography.ComputeHashCodeFor(this.CoordinateSystem, this.Points)); }
/// <summary>Determines if geography point and polygon will intersect.</summary> /// <returns>The operation result.</returns> /// <param name="operand1">The first operand.</param> /// <param name="operand2">The second operand.</param> public static bool?Intersects(this Geography operand1, Geography operand2) { return(OperationsFor(operand1, operand2).IfValidReturningNullable(ops => ops.Intersects(operand1, operand2))); }
/// <summary>Determines the Length of the geography LineString.</summary> /// <returns>The operation result.</returns> /// <param name="operand">The LineString operand.</param> public static double?Length(this Geography operand) { return(OperationsFor(operand).IfValidReturningNullable(ops => ops.Length(operand))); }
/// <summary>Determines the distance of the geography.</summary> /// <returns>The operation result.</returns> /// <param name="operand1">The first operand.</param> /// <param name="operand2">The second operand.</param> public static double?Distance(this Geography operand1, Geography operand2) { return(OperationsFor(operand1, operand2).IfValidReturningNullable(ops => ops.Distance(operand1, operand2))); }
/// <summary>Indicates a Geography Intersects() method.</summary> /// <returns>The operation result.</returns> /// <param name="operand1">The Operand 1, point.</param> /// <param name="operand2">The Operand 2, polygon.</param> public virtual bool Intersects(Geography operand1, Geography operand2) { throw new NotImplementedException(); }
/// <summary>Indicates a Geography LineString's length.</summary> /// <returns>The operation result.</returns> /// <param name="operand">The Operand.</param> public virtual double Length(Geography operand) { throw new NotImplementedException(); }
/// <summary>Indicates a Geography Distance.</summary> /// <returns>The operation result.</returns> /// <param name="operand1">The Operand 1.</param> /// <param name="operand2">The Operand 2.</param> public virtual double Distance(Geography operand1, Geography operand2) { throw new NotImplementedException(); }