This repository contains the source code for IBI Group's .NET 6.0 WZDx (Work Zone Data Exchange) class library, IBI.WZDx
.
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 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
.
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
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);
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);
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.
This solution includes a IBI.WZDx.UnitTests Xunit test project. Run all unit tests with the following command:
dotnet test