Exemple #1
0
        public string FindIntersect1(List <Latlongs> objs)
        {
            string polyString = "POLYGON((";

            foreach (var o in objs)
            {
                polyString += o.lng.ToString() + ' ' + o.lat.ToString() + ',';
            }
            polyString += objs[0].lng.ToString() + ' ' + objs[0].lat.ToString() + ',';
            polyString  = polyString.TrimEnd(',') + "))";
            try
            {
                string parcelIds = null;
                using (var context = new sdeBRTestEntities1())
                {
                    string sql = "select * " +
                                 " from dbo.PropertyList pl " +
                                 " where pl.geom.STIntersects((geography::STGeomFromText('" + polyString + "', 4326)).ReorientObject()) = 1 ";
                    //string sql = "select * " +
                    //            "from dbo.PropertyList pl " +
                    //            "where pl.geom.STIntersects(geography::STGeomFromText('POLYGON((-90.948429 30.4892, -90.948429 30.49690,  -90.9374427 30.49690, -90.9374427 30.489213526, -90.948429 30.4892))', 4326)) = 1 " +
                    //            "and pl.ParcelNumb < 1000";

                    parcelIds = GetGeoJsonString(context.Database.SqlQuery <PropertyList>(sql).ToList());
                }
                return(parcelIds);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemple #2
0
        public string GetPropertyList()
        {
            List <PropertyList> properties = null;

            using (var context = new sdeBRTestEntities1())
            {
                properties = (from p in context.PropertyLists select p).ToList();

                //var properties = context.PropertyLists.Where(p => new[]{333435,333450,334847,358085,359182}.Any(pn => pn == p.ParcelNumb ));
            }



            return(GetGeoJsonString(properties));
        }