A small TypeScript client for public SI2PEM data, including WFS, WMS, installations, planned measurements, and laboratory reports.
npm install si2pem-readerESM only.
import { SI2PEMClient, SI2PEM_WFS_FEATURE_TYPES, SI2PEM_WMS_LAYERS } from "si2pem-reader";
const si2pem = new SI2PEMClient();
const measurements = await si2pem.getFeatures({
typeName: SI2PEM_WFS_FEATURE_TYPES.allMeasures,
bbox: [19.8, 50.0, 20.2, 50.2],
});
const map = await si2pem.getWmsMap({
layers: SI2PEM_WMS_LAYERS.measurementResults,
bbox: [19.8, 50.0, 20.2, 50.2],
width: 1024,
height: 768,
transparent: true,
});Report discovery uses WFS GetFeature on public:measures_all, filtered by station identity. bbox is required in [west, south, east, north] order (EPSG:4326). The client matches it against each measurement point's coordinates, counting points on its edge as inside and skipping points without coordinates.
findLaboratoryReports() reads every laboratory measurement point for the station that has a report URL, across pages, and keeps the ones inside bbox and, when laboratoryName is set, from that laboratory. It then returns one report per URL, newest first. count sets the number of measurement points requested per page, including points outside bbox (default 100). It does not limit the number of distinct reports returned. getLatestLaboratoryReport() uses a default page size of 10 and stops after the first page containing a matching report. Both methods reject with a RangeError when a bbox value is not finite, or when west is greater than east or south greater than north.
const report = await si2pem.getLatestLaboratoryReport({
stationIdentity: "1862",
bbox: [19.003611, 50.225, 19.043611, 50.265],
});
const antennas = await report?.readAntennas();