/// <summary> /// A GooglePlaceModel extension method that converts a place to a lat long string. /// </summary> /// /// <remarks> Vladyslav, 25.05.2016. </remarks> /// /// <param name="place"> The place to act on. </param> /// /// <returns> place as a string. </returns> private static string ToLatLongString(this GooglePlaceModel place) { if (place.Geometry == null) { return(string.Empty); } return(string.Format("{0},{1}", place.Geometry.Location.Lat.ToGoogleString(), place.Geometry.Location.Lng.ToGoogleString())); }
public static IntermediatePoint ToIntermediatePoint(this GooglePlaceModel model, bool isStart = false, bool isEnd = false) { return(new IntermediatePoint() { Coordinates = DbGeography.FromText( string.Format("POINT({0} {1})", model.Geometry.Location.Lat.ToString(CultureInfo.InvariantCulture), model.Geometry.Location.Lng.ToString(CultureInfo.InvariantCulture)), 4326), FormattedAddress = model.FormattedAddress, Name = model.Name, PlaceId = model.PlaceId, IsStart = isStart ? 1 : 0, IsEnd = isEnd ? 1 :0 }); }