mapsight / pulp-datex-roadworks
DATEX II SituationPublication roadworks helpers for Pulp pipelines.
Package info
github.com/open-mapsight/pulp-datex-roadworks
pkg:composer/mapsight/pulp-datex-roadworks
Requires
- php: ^8.2
- ext-libxml: *
- ext-simplexml: *
- mapsight/pulp: *
- mapsight/pulp-mobilithek: *
Requires (Dev)
None
Suggests
- mapsight/pulp-cache: Cache Mobilithek subscription responses
- mapsight/pulp-json: Encode GeoJSON output
- mapsight/pulp-xml: Parse DATEX II v2 XML in a Pulp pipeline before this package
Provides
None
Conflicts
None
Replaces
None
README
DATEX II v2 SituationPublication helpers for Pulp pipelines: parse, bbox,
GML, and GeoJSON. Fetch a Mobilithek subscription with
PulpDatexRoadworks::srcMobilithek() (the same helper as the other DATEX
packages, implemented in mapsight/pulp-mobilithek).
Features
- Mobilithek src helper: Configures
Pulp::srcHttpwith the default subscription URL,Accept-Encoding: gzip, and P12 client-cert curl options. Certificate path, password, and subscription ID stay caller-supplied. - Situation records → GeoJSON: One feature per in-bbox
situationRecord(Roadworksand other DATEX situation types that carry a location). - Locations: DATEX
<latitude>/<longitude>when present, plus GMLposList/pos. EPSG:4326 / WGS84 is lat/lon; CRS84 is lon/lat. GeoJSON is always lon, lat. - Bounding box filtering: Limits records to
[minLon, minLat, maxLon, maxLat]. - Feed kind: Optional
feedKind(ald,akd,bab, …) is stored on each feature so applications can merge multiple catalogs. - Presentation-neutral output: Source and data properties only. Applications add icons, HTML descriptions, and localized labels afterwards.
Installation
composer require mapsight/pulp-datex-roadworks
This package depends on mapsight/pulp and mapsight/pulp-mobilithek.
Roadworks GeoJSON
use OpenMapsight\Pulp; use OpenMapsight\PulpDatexRoadworks; use OpenMapsight\PulpJSON; Pulp::start() ->pipe(PulpDatexRoadworks::srcMobilithek( subscriptionId: $subscriptionId, certPath: $certPath, certPassword: $certPassword, ifModifiedSince: $ifModifiedSince, aliasFileName: 'mobilithek.xml', )) ->pipe(PulpDatexRoadworks::roadworksGeoJson( bbox: [10.30, 52.12, 10.80, 52.42], sourceUrl: 'https://example.com/open-data-docs', sourceName: 'DATEX Roadworks', documentationUrl: 'https://example.com/open-data-docs', publicSourceUrl: 'https://example.com/open-data-docs', options: ['feedKind' => 'ald'], )) ->pipe(PulpJSON::encodeJSON(JSON_PRETTY_PRINT)) ->pipe(Pulp::dest(__DIR__ . '/result')) ->run();
The handler accepts a DATEX II v2 XML string, a SOAP container, or an already-decoded array. Records without a usable point or GML line are dropped.
Builder
use OpenMapsight\PulpDatexRoadworks; $builder = PulpDatexRoadworks::roadworksBuilder( bbox: [10.30, 52.12, 10.80, 52.42], sourceUrl: 'https://example.com/open-data-docs', sourceName: 'DATEX Roadworks', documentationUrl: 'https://example.com/open-data-docs', publicSourceUrl: 'https://example.com/open-data-docs', options: ['feedKind' => 'akd'], ); $geoJson = $builder->build($xml); $features = $builder->featuresFromPublication($xml);
Feature properties
Roadworks features include:
recordId,situationIdname,comment,locationNamerecordType(DATEXxsi:type, oftenRoadworks)feedKindroadMaintenanceType,roadworksDuration,underTrafficprobabilityOfOccurrencestart,end,updatedAtsource,sourceUrl,documentationUrl
Geometry is a Point, a LineString from GML, or a GeometryCollection
of both when a display point and a line are present.
Notes
- Certificate path, password, and subscription ID stay caller-supplied.
- Presentation (icons, localized copy, catalog merge) belongs in the consuming application.
- Alert-C location-table lookup is not implemented. GML
posListis enough for Autobahn MIA publications. srcMobilithek()only configuresPulp::srcHttp. Cache withPulpCache::remember.