예제 #1
0
        public StatisticalAreaClassification WhatRegions(LatLong pt)
        {
            if (Locations.TryGetValue(pt, out var area))
            {
                return(area);
            }


            // else work out where fits
            var clas = new StatisticalAreaClassification(pt);

            foreach (var setpair in SASets)
            {
                (bool found, StatAreaLocation loc) = InFeatureSet(pt, setpair.Value);

                if (!found)
                {
                    (found, loc) = NearestBoundingBox(pt, setpair.Value);
                }

                if (found)
                {
                    clas.Regions.Add(setpair.Key, loc);

                    if (!SANames.TryGetValue(setpair.Key, out var outer))
                    {
                        outer = new Dictionary <long, string>();
                        SANames.Add(setpair.Key, outer);
                    }

                    if (!outer.ContainsKey(loc.Id))
                    {
                        outer.Add(loc.Id, loc.Name);
                    }
                }
                else
                {
                    //   Console.WriteLine($"Still Missed {setpair.Key}\t{pt.Lat}, {pt.Lon}");
                }
            }

            return(clas);
        }
예제 #2
0
 public StatisticalAreaClassification(StatisticalAreaClassification src)
 {
     Location = src.Location;
     Regions  = new Dictionary <StatArea, StatAreaLocation>(src.Regions);
 }