Skip to main content

Automatic RoadNetId Selection System

The Automatic RoadNetId Selection System enables the API to automatically determine the appropriate RoadNet for incoming requests based on input coordinates. This eliminates the need for clients to manually specify the roadNetId parameter when making API calls.

Overview

It consists of four main components:

  1. AlphaShape API Endpoint - REST endpoint for requesting alpha shape data of a specific RoadNet
  2. AlphaShapeCache - In-memory cache storing alpha shape polygons for all RoadNets
  3. PeriodicAlphaShapeService - Background service that populates and maintains the cache
  4. RoadNetIdCalculator - Logic for determining which RoadNet contains given coordinates

How It Works

It operates on the following principle:

  1. Cache Population: The PeriodicAlphaShapeService automatically requests alpha shapes for all available RoadNets and stores them in the AlphaShapeCache
  2. Matching: When a request contains coordinates, the RoadNetIdCalculator uses the cached alpha shapes to determine which RoadNet contains those coordinates
  3. Automatic Selection: The determined RoadNet ID is used for processing the request

Integration with Request Processing

The automatic RoadNetId selection integrates seamlessly with the existing request processing pipeline:

  1. Request Validation: Standard request validation occurs first
  2. Coordinate Extraction: Extracts coordinates from requests implementing IKnownRequestWithCoordinates
  3. RoadNetId Calculator: RoadNetIdCalculator determines the appropriate RoadNet
  4. Request Processing: Request proceeds with the automatically determined RoadNet