Example #1
0
 public GeoJSONFeature(GEORegion region, Dictionary <string, object> attributes)
 {
     geometry = new GeoJSONGeometry(region);
     foreach (var kvp in attributes)
     {
         properties.Add(kvp.Key, kvp.Value);
     }
 }
Example #2
0
 public GeoJSONGeometry(GEORegion region)
 {
     type = GeoJSONGeometryType.MultiPolygon;
     
     List<double[][][]> coordTemp = new List<double[][][]>();
     for(int i = 0; i < region.count(); i++)
         coordTemp.Add(GeoJSONPolygon(region.item(i)));
     coordinates = coordTemp.ToArray();
 }
Example #3
0
 public GeoJSONFeature(Catchment c, GEORegion region)
 {
     id = UriTemplates.Catchment.Replace("{catchmentId}", c.id.ToString());
     properties.Add("name", c.Name);
     properties.Add(FeatureTypeProperty, "catchment");
     properties.Add("link", c.DownstreamLink != null ? LinkURL(c.DownstreamLink) : null);
     properties.Add("areaInSquareMeters", c.characteristics.areaInSquareMeters);
     geometry = new GeoJSONGeometry(region);
 }
        private void removeElements(List <Link> startingLinks)
        {
            //Set subcatchraster to null to make things quicker
            Scenario.GeographicData.SubCatchmentRaster = null;

            //Intersected Subcats/FUs
            if (Scenario.GeographicData.IntersectedSCFUPolygons != null)
            {
                Scenario.GeographicData.IntersectedSCFUPolygons = null;
            }

            //reporting regions
            if (Scenario.GeographicData.ReportingRegions != null)
            {
                Scenario.GeographicData.ReportingRegions = null;
            }

            catDblsToRemove        = new List <double>();
            nodesPreviouslyRemoved = new List <string>();

            int keepCatchCount = 0;

            foreach (Link li in ignoreLinks)
            {
                double numCatchments = countUpstreamCatchmentsForThisLink(li, 0);
                keepCatchCount += (int)numCatchments;
            }

            foreach (Link li in startingLinks)
            {
                removeEverythingUpstreamOfAndIncludingLink(li);
            }

            foreach (double theCatVal in catDblsToRemove)
            {
                GEORegion gr = Scenario.GeographicData.SubCatchmentOutline.findRegionWithValue(theCatVal);
                Scenario.GeographicData.SubCatchmentOutline.regions.remove(gr);

                if (Scenario.GeographicData.SubCatchmentOutline.Categories.ContainsKey(theCatVal))
                {
                    Scenario.GeographicData.SubCatchmentOutline.Categories.Remove(theCatVal);
                }
            }

            string theTempFolder = Scenario.Project.TemporaryFolder;
            string idNum         = Scenario.GeographicData.SubCatchmentOutline.PersistenceId.ToString();

            saveShapefile(theTempFolder + "\\" + idNum + ".shp", Scenario.GeographicData.SubCatchmentOutline);

            TIME.Management.Memory.ClearAllAvailableMemory();
            Thread.Sleep(1500);
        }
Example #5
0
        public GeoJSONGeometry(GEORegion region)
        {
            type = GeoJSONGeometryType.MultiPolygon;

            List <double[][][]> coordTemp = new List <double[][][]>();

#if BeforeCaseRefactor
            for (int i = 0; i < region.count(); i++)
#else
            for (int i = 0; i < region.Count; i++)
#endif
            { coordTemp.Add(GeoJSONPolygon(region.item(i))); }
            coordinates = coordTemp.ToArray();
        }
Example #6
0
 public GeoJSONFeature(GEORegion region, Dictionary<string,object> attributes)
 {
     geometry = new GeoJSONGeometry(region);
     foreach (var kvp in attributes)
     {
         properties.Add(kvp.Key,kvp.Value);
     }
 }
Example #7
0
 public GeoJSONFeature(Catchment c,GEORegion region)
 {
     id = UriTemplates.Catchment.Replace("{catchmentId}", c.id.ToString());
     properties.Add("name", c.Name);
     properties.Add(FeatureTypeProperty,"catchment");
     properties.Add("link",LinkURL(c.DownstreamLink));
     geometry = new GeoJSONGeometry(region);
 }