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:
- AlphaShape API Endpoint - REST endpoint for requesting alpha shape data of a specific RoadNet
- AlphaShapeCache - In-memory cache storing alpha shape polygons for all RoadNets
- PeriodicAlphaShapeService - Background service that populates and maintains the cache
- RoadNetIdCalculator - Logic for determining which RoadNet contains given coordinates
How It Works
It operates on the following principle:
- Cache Population: The
PeriodicAlphaShapeService
automatically requests alpha shapes for all available RoadNets and stores them in theAlphaShapeCache
- Matching: When a request contains coordinates, the
RoadNetIdCalculator
uses the cached alpha shapes to determine which RoadNet contains those coordinates - 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:
- Request Validation: Standard request validation occurs first
- Coordinate Extraction: Extracts coordinates from requests implementing
IKnownRequestWithCoordinates
- RoadNetId Calculator:
RoadNetIdCalculator
determines the appropriate RoadNet - Request Processing: Request proceeds with the automatically determined RoadNet