Skip to content

Models and utitlies for producing and consuming Work Zone Data Exchange (WZDx) data feeds in .NET.

License

Notifications You must be signed in to change notification settings

ibi-group/IBI.WZDx

Repository files navigation

WZDx .NET Library

This repository contains the source code for IBI Group's .NET 6.0 WZDx (Work Zone Data Exchange) class library, IBI.WZDx.

About

The IBI.WZDx class library provides models and utitlies for producing and consuming Work Zone Data Exchange (WZDx) data feeds.

The library provides the following functionality:

  • Utilize WZDx concepts in .NET code.
  • Create a WZDx WorkZoneFeed or DeviceFeed GeoJSON string by serializing WZDx C# objects modeled in this library.
  • Deserialize a WZDx Work Zone Feed or Device Feed GeoJSON string into C# objects modeled in this library.

WZDx Version Support

WZDx versions 4.0, 4.1, and 4.2 are supported; the WzdxSerializer defaults to outputting v4.2 (latest WZDx).

Detour road events are not supported. When provided with a Work Zone Feed that includes detour road events, the WzdxSerializer.DeserializeFeed method will deserialize the detour events into a RoadEventFeature with Properties as null.

Usage

NuGet Package

To use the library, you need to reference it in your .NET project. The easiest way to do this is to add the IBI.WZDx NuGet package, available from nuget.org, as a dependency to your project:

dotnet add package IBI.WZDx

Create a WZDx feed GeoJSON string

Use the WzdxSerializer static class to serialize a WZDx feed object into a GeoJSON string that represents a valid WZDx feed object.

For example:

using IBI.WZDx.Models;
using IBI.WZDx.Serialization;

var myWzdxWorkZoneFeed = new WorkZoneFeed(...);

string wzdxGeoJsonString = WzdxSerializer.SerializeFeed(myWzdxWorkZoneFeed);

Read in a WZDx feed GeoJSON string

Use the WzdxSerializer static class to deserialize a WZDx feed JSON string into an IBI.WZDx library model representation of the feed content.

For Example:

using IBI.WZDx.Models;
using IBI.WZDx.Serialization;

var httpClient = new HttpClient();

HttpResponseMessage feedResponse = await httpClient.GetAsync("https://url.to.wzdx.feed/wzdx-device-feed");
string wzdxDeviceFeedGeoJson = await feedResponse.Content.ReadAsStringAsync();

DeviceFeed wzdxDeviceFeed = WzdxSerializer.DeserializeFeed<DeviceFeed>(wzdxDeviceFeedGeoJson);

Versioning

The package uses Semantic Versioning in a MAJOR.MINOR.PATCH format.

The MAJOR and MINOR version numbers correspond to the MAJOR and MINOR version numbers of the WZDx specification that it conforms to.

The PATCH version number is incremented as changes are made to the library that are unrelated to progress of WZDx.

Tests

This solution includes a IBI.WZDx.UnitTests Xunit test project. Run all unit tests with the following command:

dotnet test

About

Models and utitlies for producing and consuming Work Zone Data Exchange (WZDx) data feeds in .NET.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages