예제 #1
0
        public string GetOverlapsClause(IGeometry geom)
        {
            string wkt    = GeometryToWKT.Write(geom);
            string retval = "Intersects(GeomFromText('" + wkt + "')," + _geometryColumn + ")=1";

            return(retval);
        }
        /// <summary>
        /// Returns the box filter string needed in SQL query
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        private string GetBoxFilterStr(IEnvelope bbox)
        {
            ICoordinate ll          = new Coordinate(bbox.MinX, bbox.MinY);
            ICoordinate lr          = new Coordinate(bbox.MaxX, bbox.MinY);
            ICoordinate ur          = new Coordinate(bbox.MaxX, bbox.MaxY);
            ICoordinate ul          = new Coordinate(bbox.MinX, bbox.MaxY);
            LinearRing  ring        = new LinearRing(new[] { ll, lr, ur, ul, ll });
            Polygon     p           = new Polygon(ring);
            string      bboxText    = GeometryToWKT.Write(p);
            string      whereClause = String.Format(
                "{0}{1}.STIntersects({4}::STGeomFromText('{2}', {3})) = 1",
                this.GeometryColumn, this.MakeValidString, bboxText, this.SRID, this.spatialObject);

            return(whereClause);
        }
예제 #3
0
        private string GetBoxClause(Envelope bbox)
        {
            if (UseSpatiaLiteIndex)
            {
                return(string.Format(Map.NumberFormatEnUs, _spatiaLiteIndexClause, bbox.MaxX, bbox.MinX, bbox.MaxY, bbox.MinY));

                /*
                 * StringBuilder sql = new StringBuilder("ROWID IN ( ");
                 * sql.Append("SELECT pkid FROM ");
                 * sql.Append(SpatialIndex);
                 * sql.Append(" WHERE ");
                 * sql.AppendFormat(Map.NumberFormatEnUs,
                 *               "xmin < {0} AND xmax > {1} AND ymin < {2} AND ymax > {3} )",
                 *               bbox.Max.X, bbox.Min.X, bbox.Max.Y, bbox.Min.Y);
                 *
                 * return sql.ToString();
                 */
            }

            string wkt = GeometryToWKT.Write(LineFromBbox(bbox));

            return("MBRIntersects(GeomFromText('" + wkt + "')," + _geometryColumn + ")=1");
        }
예제 #4
0
 public string AsText()
 {
     return(GeometryToWKT.Write(this));
 }
예제 #5
0
 public new string AsText()
 {
     return(GeometryToWKT.Write(Envelope));
 }