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 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);
 }
Example #3
0
        public GeoJSONFeature(Link l, RiverSystemScenario scenario, bool useSchematicLocation)
        {
            id = LinkURL(l);
            properties.Add("name", l.Name);
            properties.Add(FeatureTypeProperty, "link");
            properties.Add("from_node", NodeURL((Node)l.UpstreamNode, l.Network));
            properties.Add("to_node", NodeURL((Node)l.DownstreamNode, l.Network));
            properties.Add("length", l.Length);

            if (useSchematicLocation)
            {
                var schematic = ScriptHelpers.GetSchematic(scenario);
                if (scenario != null)
                {
                    geometry = new GeoJSONGeometry(SchematicLocationForNode(l.from, schematic), SchematicLocationForNode(l.to, schematic));
                    return;
                }
            }
            geometry = new GeoJSONGeometry(l, useSchematicLocation);
        }
Example #4
0
        public GeoJSONFeature(Node n, RiverSystemScenario scenario, bool useSchematicLocation)
        {
            id = NodeURL(n, scenario.Network);

            properties.Add("name", n.Name);
            properties.Add(FeatureTypeProperty, "node");
            Coordinate loc       = n.location;
            var        schematic = ScriptHelpers.GetSchematic(scenario);

            if (schematic != null)
            {
                PointF schematicLocation = SchematicLocationForNode(n, schematic);
                properties.Add("schematic_location", new double[] { schematicLocation.X, schematicLocation.Y });
                if (useSchematicLocation)
                {
                    loc = new Coordinate(schematicLocation);
                }
            }
            properties.Add(ResourceProperty,
                           UriTemplates.Resources.Replace("{resourceName}", ResourceName(n)));

            geometry = new GeoJSONGeometry(loc);
        }