Skip to main content

parse_netrelations_geojson

Function parse_netrelations_geojson 

Source
pub fn parse_netrelations_geojson(
    path: &str,
) -> Result<Vec<NetRelation>, ProjectionError>
Expand description

Parse netrelations from GeoJSON file

Expects a FeatureCollection with features that have type="netrelation" property. Netrelations can have optional Point geometry representing the connection point.

§Required Properties

  • type: Must be “netrelation”
  • id: Netrelation identifier
  • netelementA: ID of first netelement
  • netelementB: ID of second netelement
  • positionOnA: Position on netelementA (0 or 1)
  • positionOnB: Position on netelementB (0 or 1)
  • navigability: “both”, “AB”, “BA”, or “none”

§Arguments

  • path - Path to GeoJSON file

§Returns

Vector of NetRelation structs

§Example GeoJSON

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.3517, 50.8503]
      },
      "properties": {
        "type": "netrelation",
        "id": "NR_001",
        "netelementA": "NE_001",
        "netelementB": "NE_002",
        "positionOnA": 1,
        "positionOnB": 0,
        "navigability": "both"
      }
    }
  ]
}