Exemplo n.º 1
0
        public IEnumerable <HeatMapPointDTO> GetFeaturesInRegion([FromBody] Bound region)
        {
            String polygonQuery = "POLYGON((" +
                                  region.West.ToString(true) + " " + region.North.ToString(true) + "," +
                                  region.West.ToString(true) + " " + region.South.ToString(true) + "," +
                                  region.East.ToString(true) + " " + region.South.ToString(true) + "," +
                                  region.East.ToString(true) + " " + region.North.ToString(true) + "," +
                                  region.West.ToString(true) + " " + region.North.ToString(true) + "))";

            var poly   = DbGeography.PolygonFromText(polygonQuery, 4326);
            var points = db.HeatmapPointModel.Where(p => poly.Intersects(p.coordinates))
                         .Select(p => new HeatMapPointDTO()
            {
                location = new PointDTO()
                {
                    ID  = p.ID,
                    lat = p.coordinates.Latitude.Value,
                    lng = p.coordinates.Longitude.Value
                },
                CracksDensity = p.CracksDensity,
                TreesDensity  = p.TreesDensity
            });

            return(points);
        }
        private static DbGeography GetDbGeographyFromPolygon(JToken geometry)
        {
            JArray coordinates = geometry.SelectToken("coordinates").Value<JArray>();
            StringBuilder polygonText = new StringBuilder("POLYGON(");
            foreach (var ring in coordinates)
            {
                polygonText.Append("(");
                bool isFirst = true;
                foreach (var coordinate in ring)
                {
                    double x = coordinate[0].Value<double>();
                    double y = coordinate[1].Value<double>();
                    if (!isFirst)
                    {
                        polygonText.Append(", ");
                    }

                    polygonText.Append(x.ToString(culture))
                        .Append(" ")
                        .Append(y.ToString(culture));
                    isFirst = false;
                }

                polygonText.Append(")");
            }

            polygonText.Append(")");

            return DbGeography.PolygonFromText(polygonText.ToString(), 4326);
            throw new System.NotImplementedException();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new polygon location.
        /// </summary>
        /// <param name="coordinateString">String that contains the shapes. Should be formatted as: lat1,long1|lat2,long2|...</param>
        /// <param name="rowGroupCreatedDate">string to use as the CreatedDate.</param>
        /// <param name="rowGroupKey">String to use as the ForeignKey.</param>
        /// <param name="rowGroupId">Int to use as the ForeignId.</param>
        /// <returns></returns>
        private static Location CreatePolygonLocation(string coordinateString, string rowGroupCreatedDate, string rowGroupKey, int?rowGroupId)
        {
            var rockContext    = new RockContext();
            var newPolygonList = new List <Location>();

            var polygon = new Location
            {
                GeoFence                = DbGeography.PolygonFromText(Rock.Web.UI.Controls.GeoPicker.ConvertPolyToWellKnownText(coordinateString), 4326),
                CreatedDateTime         = ParseDateOrDefault(rowGroupCreatedDate, ImportDateTime),
                ModifiedDateTime        = ImportDateTime,
                CreatedByPersonAliasId  = ImportPersonAliasId,
                ModifiedByPersonAliasId = ImportPersonAliasId,
                ForeignKey              = rowGroupKey,
                ForeignId               = rowGroupId
            };

            newPolygonList.Add(polygon);

            rockContext.WrapTransaction(() =>
            {
                rockContext.Locations.AddRange(newPolygonList);
                rockContext.SaveChanges(DisableAuditing);
            });

            return(polygon);
        }
Exemplo n.º 4
0
        public static DbGeography ConvertCoordinatesToPolygon(IEnumerable <IList <float> > coordinates)
        {
            var    coordinateList = coordinates.ToList();
            double firstResult    = Math.Abs(coordinateList.First()[0] - coordinateList.Last()[0]);
            double lastResult     = Math.Abs(coordinateList.First()[1] - coordinateList.Last()[1]);
            double tolerance      = 0.000001;

            if (firstResult > tolerance || lastResult > tolerance)
            {
                throw new Exception("First and last point do not match. This is not a valid polygon");
            }

            var count = 0;
            var sb    = new StringBuilder();

            sb.Append(@"POLYGON((");
            foreach (var coordinate in coordinateList)
            {
                if (count == 0)
                {
                    sb.Append(coordinate[0].ToString(CultureInfo.InvariantCulture) + " " + coordinate[1].ToString(CultureInfo.InvariantCulture));
                }
                else
                {
                    sb.Append("," + coordinate[0].ToString(CultureInfo.InvariantCulture) + " " + coordinate[1].ToString(CultureInfo.InvariantCulture));
                }

                count++;
            }

            sb.Append(@"))");

            return(DbGeography.PolygonFromText(sb.ToString(), 4326));
        }
Exemplo n.º 5
0
        public static DbGeography ConvertGeoCoordinatesToPolygon(IEnumerable <GeoCoordinate> coordinates)
        {
            var coordinateList = coordinates.ToList();

            if (coordinateList.First() != coordinateList.Last())
            {
                throw new Exception("First and last point do not match. This is not a valid polygon");
            }

            var count = 0;
            var sb    = new StringBuilder();

            sb.Append(@"POLYGON((");

            foreach (var coordinate in coordinateList)
            {
                if (count == 0)
                {
                    sb.Append(coordinate.Longitude + " " + coordinate.Latitude);
                }
                else
                {
                    sb.Append("," + coordinate.Longitude + " " + coordinate.Latitude);
                }

                count++;
            }

            sb.Append(@"))");

            return(DbGeography.PolygonFromText(sb.ToString(), DbGeography.DefaultCoordinateSystemId));
        }
Exemplo n.º 6
0
        public static DbGeography ToDbGeographyPolygon(this IEnumerable <Position> rawPositions)
        {
            var positions = rawPositions.ToList();

            if (positions.First().ToString() != positions.Last().ToString())
            {
                positions.Add(positions.First());
            }

            var count = 0;
            var sb    = new StringBuilder();

            sb.Append(@"POLYGON((");
            foreach (var coordinate in positions)
            {
                if (count == 0)
                {
                    sb.Append(coordinate.Longitude + " " + coordinate.Latitude);
                }
                else
                {
                    sb.Append("," + coordinate.Longitude + " " + coordinate.Latitude);
                }

                count++;
            }

            sb.Append(@"))");

            return(DbGeography.PolygonFromText(sb.ToString(), 4326));
        }
Exemplo n.º 7
0
        public static DbGeography CreatePolygon(params Point[] points)
        {
            var ss = new List <string>();

            foreach (var p in points)
            {
                ss.Add(string.Format("{0} {1}", p.X, p.Y));
            }
            return(DbGeography.PolygonFromText(string.Format("POLYGON (({0}))", string.Join(",", ss)), 4326));
        }
        public static DbGeography CreatePoligon(params double[] latitude_longitude)
        {
            var text = string.Format(CultureInfo.InvariantCulture.NumberFormat,
                                     "POLYGON(({0} {1} {2},{3} {4} {5},{6} {7} {8},{9} {10} {11}))",
                                     latitude_longitude[0], " ", latitude_longitude[1], latitude_longitude[2], " ", latitude_longitude[3],
                                     latitude_longitude[4], " ", latitude_longitude[5], latitude_longitude[6], " ", latitude_longitude[7]);

            // 4326 is most common coordinate system used by GPS/Maps
            return(DbGeography.PolygonFromText(text, 4326));
        }
Exemplo n.º 9
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var host = new JobHost();

            Console.WriteLine("Subscriber Start");

            string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");

            SubscriptionClient Client = SubscriptionClient.CreateFromConnectionString(connectionString, "Storm", "StormSubcription");

            // Configure the callback options.
            OnMessageOptions options = new OnMessageOptions();

            options.AutoComplete = false;

            // options.AutoRenewTimeout = TimeSpan.FromMinutes(1);

            Client.OnMessage((message) =>
            {
                try
                {
                    var data = message.GetBody <string>();

                    WarnDataset warnDataset = JsonConvert.DeserializeObject <WarnDataset>(data);

                    System.Data.Entity.Spatial.DbGeography shape = DbGeography.PolygonFromText(warnDataset.SHAPE.ToString(), 4326);


                    //System.Data.Entity.Spatial.DbGeography shape= DbGeography.PolygonFromText("POLYGON ((-95.08 38.04, -95.08 37.86, -94.69 37.87, -94.66 38.03, -95.08 38.04))", 4326);

                    // This code will move to another project

                    using (var db = new DataLakeEntities())
                    {
                        int insertWeatherDatasets = db.uspInsertWarningData(warnDataset.WARNINGTYPE, warnDataset.MESSAGEID, shape, warnDataset.ZTIME_END, warnDataset.ZTIME_START, warnDataset.ID, warnDataset.ISSUEWFO);
                    }

                    // Remove message from subscription.
                    message.Complete();
                }

                catch (Exception ex)
                {
                    // Indicates a problem, unlock message in subscription.
                    message.Abandon();
                }
            }, options);



            Console.ReadLine();

            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Exemplo n.º 10
0
        public static DbGeography GeneratePolygonFromCoordinates(double latitude1, double longitude1, double latitude2,
                                                                 double longitude2)
        {
            var geomText = GeneratePolygonTextFromCoordinates(latitude1, longitude1, latitude2, longitude2);

            DbGeography polygon = DbGeography.PolygonFromText(geomText, DbGeography.DefaultCoordinateSystemId);

            //4326 = [WGS84]

            return(polygon);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Determines whether [is geo fence valid] [the specified error message].
        /// </summary>
        /// <param name="errorMessage">The error message.</param>
        /// <returns>
        ///   <c>true</c> if [is geo fence valid] [the specified error message]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsGeoFenceValid(out string errorMessage)
        {
            EnsureChildControls();
            if (string.IsNullOrWhiteSpace(_hfGeoPath.Value))
            {
                errorMessage = string.Empty;
                return(true);
            }

            try
            {
                /*
                 * 8/7/2020 - NA
                 * We use the SqlGeography as an intermediate conversion because it has
                 * methods to determine if the fence is a single polygon (has 1 geometry).
                 * If that passes, then we can consider the geo-fence valid.
                 *
                 * Reason: Some administrators were creating incompatible shapes using the
                 * GeoPicker that will otherwise break the check-in geo-location kiosk matching.
                 */
                var polygonText  = ConvertPolyToWellKnownText(_hfGeoPath.Value);
                var sqlGeography = SqlGeography.STGeomFromText(new SqlChars(polygonText), DbGeography.DefaultCoordinateSystemId).MakeValid();

                if (sqlGeography == null || !sqlGeography.STIsValid())
                {
                    errorMessage = "The selected geo-fence path is invalid.";
                    return(false);
                }

                if (sqlGeography.STNumGeometries() > 1)
                {
                    errorMessage = "The geo-fence has overlapping lines or is made up of multiple polygons. Only one polygon is allowed.";
                    return(false);
                }

                var dbGeography = DbGeography.PolygonFromText(polygonText, DbGeography.DefaultCoordinateSystemId);
                if (dbGeography == null)
                {
                    errorMessage = "Unable to convert the given geo-fence path to a compatible format.";
                    return(false);
                }
            }
            catch
            {
                errorMessage = "Unable to convert the given geo-fence path to a compatible format.";
                return(false);
            }

            errorMessage = string.Empty;
            return(true);
        }
Exemplo n.º 12
0
        public DbGeography CreatePolygon(string s)
        {
            var spl          = s.Split(':');
            var pointsString = new StringBuilder();

            foreach (var s1 in spl)
            {
                var latLon = s1.Split(';');
                // var lotLanString = $"{latLon[1]} {latLon[0]},";
                pointsString.Append($"{latLon[1]} {latLon[0]},");
            }

            pointsString.Append(pointsString.ToString().Split(',').First());

            return(DbGeography.PolygonFromText($"POLYGON(({pointsString}))", 4326));
        }
Exemplo n.º 13
0
        public static IncendioObjt GetRandomObjetc()
        {
            IncendioObjt ince = new IncendioObjt();

            var rnd = new Random();

            var validZone = DbGeography.PolygonFromText("30", 4326);

            var posRandom = GetRandomPointInZone(validZone, rnd);

            ince.Lat = Double.Parse(posRandom.Latitude); 
            ince.Lat = Double.Parse(posRandom.Longitude);
            ince.NombreCasa = GenerarTextoAleatorio();

            return ince;
 
        }
Exemplo n.º 14
0
        private static DbGeography ToPolygon(Pnt[] points)
        {
            var polygon = $"POLYGON(({str.Join(", ", points.Select(a => $"{a.Longitude.ToString(CultureInfo.InvariantCulture)} {a.Latitude.ToString(CultureInfo.InvariantCulture)}"))}))";

            return(DbGeography.PolygonFromText(polygon, DbGeography.DefaultCoordinateSystemId));
        }
Exemplo n.º 15
0
                private static IEnumerable <MethodInfo> GetSupportedMethods()
                {
                    yield return(GetStaticMethod(() => DbGeography.FromText(default(string))));

                    yield return(GetStaticMethod(() => DbGeography.FromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.PointFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.LineFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.PolygonFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.MultiPointFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.MultiLineFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.MultiPolygonFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.GeographyCollectionFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.FromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.FromBinary(default(byte[]))));

                    yield return(GetStaticMethod(() => DbGeography.PointFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.LineFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.PolygonFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.MultiPointFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.MultiLineFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.MultiPolygonFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.GeographyCollectionFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeography.FromGml(default(string))));

                    yield return(GetStaticMethod(() => DbGeography.FromGml(default(string), default(int))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.AsBinary()));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.AsGml()));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.AsText()));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.SpatialEquals(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Disjoint(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Intersects(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Buffer(default(double))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Distance(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Intersection(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Union(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.Difference(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.SymmetricDifference(default(DbGeography))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.ElementAt(default(int))));

                    yield return(GetInstanceMethod((DbGeography geo) => geo.PointAt(default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.FromText(default(string))));

                    yield return(GetStaticMethod(() => DbGeometry.FromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.PointFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.LineFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.PolygonFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.MultiPointFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.MultiLineFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.MultiPolygonFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.GeometryCollectionFromText(default(string), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.FromBinary(default(byte[]))));

                    yield return(GetStaticMethod(() => DbGeometry.FromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.PointFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.LineFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.PolygonFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.MultiPointFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.MultiLineFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.MultiPolygonFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.GeometryCollectionFromBinary(default(byte[]), default(int))));

                    yield return(GetStaticMethod(() => DbGeometry.FromGml(default(string))));

                    yield return(GetStaticMethod(() => DbGeometry.FromGml(default(string), default(int))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.AsBinary()));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.AsGml()));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.AsText()));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.SpatialEquals(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Disjoint(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Intersects(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Touches(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Crosses(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Within(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Contains(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Overlaps(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Relate(default(DbGeometry), default(string))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Buffer(default(double))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Distance(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Intersection(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Union(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.Difference(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.SymmetricDifference(default(DbGeometry))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.ElementAt(default(int))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.PointAt(default(int))));

                    yield return(GetInstanceMethod((DbGeometry geo) => geo.InteriorRingAt(default(int))));
                }
Exemplo n.º 16
0
                private static Dictionary <MethodInfo, string> GetRenamedMethodFunctions()
                {
                    var result = new Dictionary <MethodInfo, string>();

                    result.Add(GetStaticMethod(() => DbGeography.FromText(default(string))), "GeographyFromText");
                    result.Add(GetStaticMethod(() => DbGeography.FromText(default(string), default(int))), "GeographyFromText");
                    result.Add(GetStaticMethod(() => DbGeography.PointFromText(default(string), default(int))), "GeographyPointFromText");
                    result.Add(GetStaticMethod(() => DbGeography.LineFromText(default(string), default(int))), "GeographyLineFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeography.PolygonFromText(default(string), default(int))), "GeographyPolygonFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeography.MultiPointFromText(default(string), default(int))), "GeographyMultiPointFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeography.MultiLineFromText(default(string), default(int))), "GeographyMultiLineFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeography.MultiPolygonFromText(default(string), default(int))),
                        "GeographyMultiPolygonFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeography.GeographyCollectionFromText(default(string), default(int))),
                        "GeographyCollectionFromText");
                    result.Add(GetStaticMethod(() => DbGeography.FromBinary(default(byte[]), default(int))), "GeographyFromBinary");
                    result.Add(GetStaticMethod(() => DbGeography.FromBinary(default(byte[]))), "GeographyFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeography.PointFromBinary(default(byte[]), default(int))), "GeographyPointFromBinary");
                    result.Add(GetStaticMethod(() => DbGeography.LineFromBinary(default(byte[]), default(int))), "GeographyLineFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeography.PolygonFromBinary(default(byte[]), default(int))), "GeographyPolygonFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeography.MultiPointFromBinary(default(byte[]), default(int))),
                        "GeographyMultiPointFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeography.MultiLineFromBinary(default(byte[]), default(int))),
                        "GeographyMultiLineFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeography.MultiPolygonFromBinary(default(byte[]), default(int))),
                        "GeographyMultiPolygonFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeography.GeographyCollectionFromBinary(default(byte[]), default(int))),
                        "GeographyCollectionFromBinary");
                    result.Add(GetStaticMethod(() => DbGeography.FromGml(default(string))), "GeographyFromGml");
                    result.Add(GetStaticMethod(() => DbGeography.FromGml(default(string), default(int))), "GeographyFromGml");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.AsBinary()), "AsBinary");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.AsGml()), "AsGml");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.AsText()), "AsText");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.SpatialEquals(default(DbGeography))), "SpatialEquals");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Disjoint(default(DbGeography))), "SpatialDisjoint");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Intersects(default(DbGeography))), "SpatialIntersects");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Buffer(default(double))), "SpatialBuffer");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Distance(default(DbGeography))), "Distance");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Intersection(default(DbGeography))), "SpatialIntersection");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Union(default(DbGeography))), "SpatialUnion");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.Difference(default(DbGeography))), "SpatialDifference");
                    result.Add(
                        GetInstanceMethod((DbGeography geo) => geo.SymmetricDifference(default(DbGeography))), "SpatialSymmetricDifference");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.ElementAt(default(int))), "SpatialElementAt");
                    result.Add(GetInstanceMethod((DbGeography geo) => geo.PointAt(default(int))), "PointAt");
                    result.Add(GetStaticMethod(() => DbGeometry.FromText(default(string))), "GeometryFromText");
                    result.Add(GetStaticMethod(() => DbGeometry.FromText(default(string), default(int))), "GeometryFromText");
                    result.Add(GetStaticMethod(() => DbGeometry.PointFromText(default(string), default(int))), "GeometryPointFromText");
                    result.Add(GetStaticMethod(() => DbGeometry.LineFromText(default(string), default(int))), "GeometryLineFromText");
                    result.Add(GetStaticMethod(() => DbGeometry.PolygonFromText(default(string), default(int))), "GeometryPolygonFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.MultiPointFromText(default(string), default(int))), "GeometryMultiPointFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.MultiLineFromText(default(string), default(int))), "GeometryMultiLineFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.MultiPolygonFromText(default(string), default(int))),
                        "GeometryMultiPolygonFromText");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.GeometryCollectionFromText(default(string), default(int))),
                        "GeometryCollectionFromText");
                    result.Add(GetStaticMethod(() => DbGeometry.FromBinary(default(byte[]))), "GeometryFromBinary");
                    result.Add(GetStaticMethod(() => DbGeometry.FromBinary(default(byte[]), default(int))), "GeometryFromBinary");
                    result.Add(GetStaticMethod(() => DbGeometry.PointFromBinary(default(byte[]), default(int))), "GeometryPointFromBinary");
                    result.Add(GetStaticMethod(() => DbGeometry.LineFromBinary(default(byte[]), default(int))), "GeometryLineFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.PolygonFromBinary(default(byte[]), default(int))), "GeometryPolygonFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.MultiPointFromBinary(default(byte[]), default(int))),
                        "GeometryMultiPointFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.MultiLineFromBinary(default(byte[]), default(int))), "GeometryMultiLineFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.MultiPolygonFromBinary(default(byte[]), default(int))),
                        "GeometryMultiPolygonFromBinary");
                    result.Add(
                        GetStaticMethod(() => DbGeometry.GeometryCollectionFromBinary(default(byte[]), default(int))),
                        "GeometryCollectionFromBinary");
                    result.Add(GetStaticMethod(() => DbGeometry.FromGml(default(string))), "GeometryFromGml");
                    result.Add(GetStaticMethod(() => DbGeometry.FromGml(default(string), default(int))), "GeometryFromGml");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.AsBinary()), "AsBinary");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.AsGml()), "AsGml");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.AsText()), "AsText");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.SpatialEquals(default(DbGeometry))), "SpatialEquals");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Disjoint(default(DbGeometry))), "SpatialDisjoint");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Intersects(default(DbGeometry))), "SpatialIntersects");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Touches(default(DbGeometry))), "SpatialTouches");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Crosses(default(DbGeometry))), "SpatialCrosses");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Within(default(DbGeometry))), "SpatialWithin");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Contains(default(DbGeometry))), "SpatialContains");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Overlaps(default(DbGeometry))), "SpatialOverlaps");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Relate(default(DbGeometry), default(string))), "SpatialRelate");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Buffer(default(double))), "SpatialBuffer");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Distance(default(DbGeometry))), "Distance");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Intersection(default(DbGeometry))), "SpatialIntersection");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Union(default(DbGeometry))), "SpatialUnion");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.Difference(default(DbGeometry))), "SpatialDifference");
                    result.Add(
                        GetInstanceMethod((DbGeometry geo) => geo.SymmetricDifference(default(DbGeometry))), "SpatialSymmetricDifference");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.ElementAt(default(int))), "SpatialElementAt");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.PointAt(default(int))), "PointAt");
                    result.Add(GetInstanceMethod((DbGeometry geo) => geo.InteriorRingAt(default(int))), "InteriorRingAt");
                    return(result);
                }
Exemplo n.º 17
0
 public static DbGeography PolygonFromText(string sPolygon)
 {
     return(DbGeography.PolygonFromText(string.Format("POLYGON({0})", sPolygon), SRID_GOOGLE_MAPS));
 }
Exemplo n.º 18
0
 internal DbGeography ToDbGeography(int epsg)
 {
     return(DbGeography.PolygonFromText(ToWKT(), epsg));
 }
Exemplo n.º 19
0
 public static DbGeography Parse(IEnumerable <IEnumerable <IEnumerable <double> > > input)
 {
     return(DbGeography.PolygonFromText(GetPolygonWkt(input), DbGeography.DefaultCoordinateSystemId));
 }