Exemple #1
0
        public ActionResult getStaticFromLoaction([FromQuery] string village)
        {
            if (!string.IsNullOrEmpty(village))
            {
                landSpaces = landSpaces.FindAll(item => item.QSDWMC == village);
            }
            var xzqList = landSpaces.GroupBy(x => x.QSDWMC).ToList();//按照权属单位名称分为村子一类的列表
            List <StaticXZQResult> list = new List <StaticXZQResult>();

            foreach (var item in xzqList)
            {
                StaticXZQResult staticXZQResult = new StaticXZQResult();
                var             totalArea       = item.Sum(x => x.SHAPE_Area);//求村子的总面积
                var             res             = item.GroupBy(x => x.ZRZYFLMC).Select(x =>
                                                                                       new cateArea
                {
                    cateName = x.Key,
                    area     = x.Sum(t => t.SHAPE_Area),
                    percent  = x.Sum(t => t.SHAPE_Area) / totalArea * 100
                }).ToList();
                staticXZQResult.XZQMC = item.Key;

                staticXZQResult.cateArea = res;
                list.Add(staticXZQResult);
            }
            var result = list.Find(item => item.XZQMC == village);

            return(Ok(result));
        }
Exemple #2
0
        public ActionResult getStaticDataByQSXZ([FromQuery] string code)
        {
            var codeList = landSpaces.GroupBy(x => x.QSXZ).ToList();
            List <StaticXZQResult> staticXZQResultList = new List <StaticXZQResult>();

            foreach (var item in codeList)
            {
                StaticXZQResult staticXZQResults = new StaticXZQResult();
                var             totalArea        = item.Sum(x => x.SHAPE_Area);
                var             res = item.GroupBy(x => x.ZRZYFLMC).Select(x => new cateArea
                {
                    cateName = x.Key,
                    area     = x.Sum(t => t.SHAPE_Area),
                    percent  = x.Sum(t => t.SHAPE_Area) / totalArea
                }).ToList();
                staticXZQResults.XZQMC = item.Key;

                staticXZQResults.cateArea = res;
                staticXZQResultList.Add(staticXZQResults);
            }
            var result = staticXZQResultList.Find(item => item.XZQMC == code);

            return(Ok(result));
        }