@siva-sub/mcp-public-transport
Version:
A Model Context Protocol server for Singapore transport data with real-time information and routing
53 lines (52 loc) • 1.3 kB
TypeScript
/**
* Polyline processing service for route geometry handling
*/
export interface GeoJSONLineString {
type: 'LineString';
coordinates: Array<[number, number]>;
}
export interface DecodedPolyline {
coordinates: Array<[number, number]>;
bounds: {
north: number;
south: number;
east: number;
west: number;
};
}
export interface PolylineData {
encoded: string;
decoded: DecodedPolyline;
geojson: GeoJSONLineString;
coordinateCount: number;
}
export declare class PolylineService {
/**
* Decode a polyline string to coordinates
*/
decode(encoded: string): DecodedPolyline;
/**
* Process polyline data from OneMap response
*/
processPolylines(response: any): PolylineData[];
/**
* Create GeoJSON LineString from coordinates
*/
private createGeoJSON;
/**
* Calculate bounding box for coordinates
*/
private calculateBounds;
/**
* Estimate coordinate count from encoded polyline
*/
estimateCoordinateCount(encoded: string): number;
/**
* Create step markers for instructions
*/
createStepMarkers(instructions: any[]): Array<{
step: number;
coordinates: [number, number];
instruction: string;
}>;
}