ParcelUtility 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package ParcelUtility --version 1.0.3
                    
NuGet\Install-Package ParcelUtility -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ParcelUtility" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ParcelUtility" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="ParcelUtility" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ParcelUtility --version 1.0.3
                    
#r "nuget: ParcelUtility, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ParcelUtility@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ParcelUtility&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=ParcelUtility&version=1.0.3
                    
Install as a Cake Tool

Parcel Utility

https://www.nuget.org/packages/ParcelUtility/

Parcel Utility is a library for finding ArcGIS parcel boundaries, downloading snapshots, and importing parcel data. It uses NetTopologySuite for geometry. Set an absolute HTTP(S) HttpClient.BaseAddress before creating a service.

Find a parcel

using Microsoft.Extensions.Logging.Abstractions;
using ParcelUtility.Boundaries;
using ParcelUtility.Parcels;

var source = new ParcelSource(
    "county-a", "County A",
    "https://example.com/arcgis/rest/services/parcels/FeatureServer");
using var http = new HttpClient
{
    BaseAddress = new Uri(source.ServiceUrl),
    Timeout = TimeSpan.FromMinutes(2),
};
http.DefaultRequestHeaders.UserAgent.ParseAdd("my-parcel-client/1.0");
var ct = CancellationToken.None;

var boundaries = ParcelBoundaryServiceFactory.Create(http, NullLoggerFactory.Instance);
var parcel = await boundaries.FindAtAsync(source, latitude: 40.1, longitude: -75.2, ct);

if (parcel is not null)
    Console.WriteLine($"{parcel.ParcelId}: {parcel.Geometry.GeometryType}");

The examples below reuse http, source, and ct.

Download a snapshot

using ParcelUtility.Downloads;

var storage = ParcelDownloadStorageFactory.CreateFileSystem("parcel-cache");
var downloader = ArcGisDownloaderFactory.Create(http, storage, NullLoggerFactory.Instance,
    additionalRetryPredicate: failure =>
        failure.RequestKind == ArcGisRequestKind.ObjectIdPage && failure.ErrorCode == 400);

var manifest = await downloader.Download(
    source with { AdditionalFields = ["OWNER_NAME"] },
    new DownloadOptions(DownloadBatchSize: 1000, RefreshHours: 168),
    ct);

Console.WriteLine($"{manifest.FeatureCount} features: {string.Join(", ", manifest.OutputFields)}");

await using var snapshot = await downloader.OpenSnapshotAsync(source.Id, manifest.SourceVersion, ct)
    ?? throw new InvalidOperationException("Snapshot is missing.");

Snapshots use gzip-compressed GeoJSON Lines. Interrupted downloads can resume from verified checkpoints, and transient request failures are retried. Set ForceDownload: true to download again instead of reusing a valid snapshot, or set MaxFeatures: 100 to limit the download. Run only one download at a time for a given source and version.

Import typed features

using ParcelUtility.Importing;

var target = new InMemoryImportTarget();
var importer = ParcelSnapshotImporterFactory.Create();
await importer.ImportAsync(snapshot, manifest, target, ct);

foreach (var feature in target.Features)
    Console.WriteLine($"{feature.Properties[manifest.ObjectIdField]}: {feature.Geometry?.GeometryType}");

Before committing, the importer checks the snapshot checksum and feature count. To import into a database, implement IParcelImportTarget and stage writes in its import session until commit.

<details> <summary>Example: an in-memory import target</summary>

using ParcelUtility.Downloads;
using ParcelUtility.Importing;
using ParcelUtility.Parcels;

public sealed class InMemoryImportTarget : IParcelImportTarget
{
    public IReadOnlyList<ParcelFeature> Features { get; private set; } = [];

    public Task<IParcelImportSession> BeginAsync(SnapshotManifest manifest, CancellationToken ct)
    {
        ct.ThrowIfCancellationRequested();
        return Task.FromResult<IParcelImportSession>(new Session(this));
    }

    private sealed class Session(InMemoryImportTarget target) : IParcelImportSession
    {
        private readonly List<ParcelFeature> staged = [];

        public Task WriteAsync(ParcelFeature feature, CancellationToken ct)
        {
            ct.ThrowIfCancellationRequested();
            staged.Add(feature);
            return Task.CompletedTask;
        }

        public Task CommitAsync(CancellationToken ct)
        {
            ct.ThrowIfCancellationRequested();
            target.Features = staged.ToArray();
            return Task.CompletedTask;
        }

        public ValueTask DisposeAsync()
        {
            staged.Clear();
            return ValueTask.CompletedTask;
        }
    }
}

</details>

Query local data first

To check a local database before querying ArcGIS, implement IParcelBoundaryRepository and pass it to the service factory:

IParcelBoundaryRepository repository = yourRepository;
var localFirst = ParcelBoundaryServiceFactory.Create(http, NullLoggerFactory.Instance, repository);
var localParcel = await localFirst.FindAtAsync(source, 40.1, -75.2, ct);

If your store returns bounding-box candidates, implement IParcelBoundaryCandidateSource. The adapter below lets the library check each candidate's exact geometry:

var exactRepository = ParcelBoundaryRepositoryFactory.FromCandidates(yourCandidateSource);
var candidateService = ParcelBoundaryServiceFactory.Create(http, NullLoggerFactory.Instance, exactRepository);
var candidateParcel = await candidateService.FindAtAsync(source, 40.1, -75.2, ct);

Return WGS84 polygons or multipolygons from the repository. When no local parcel matches, the service queries ArcGIS; errors from the local backend are passed through.

Serialize geometry

To preserve elevation coordinates in GeoJSON, create the serializer with dimension 3:

using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
using Newtonsoft.Json;

var serializer = GeoJsonSerializer.Create(new GeometryFactory(new PrecisionModel(), 4326), 3);
using var writer = new JsonTextWriter(Console.Out) { Formatting = Formatting.Indented };
serializer.Serialize(writer, parcel);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.8 84 11/21/2026
1.0.7 63 11/20/2026
1.0.6 55 11/20/2026
1.0.5 57 11/20/2026
1.0.4 87 11/20/2026
1.0.3 62 11/19/2026
1.0.2 61 11/19/2026
1.0.1 57 11/19/2026
1.0.0 60 11/19/2026