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); }
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); }