@golemio/parkings
Version:
Golemio Parkings Module
42 lines • 2.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OsmParkingTransformation = void 0;
const SourceEnum_1 = require("../../../helpers/constants/SourceEnum");
const GeodataHelper_1 = require("../../helpers/GeodataHelper");
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
class OsmParkingTransformation extends AbstractTransformation_1.AbstractTransformation {
constructor(transformationDate) {
super();
this.transformationDate = transformationDate;
this.name = "OsmParkingTransformation";
this.transformInternal = (element) => {
const transformed = {
id: `${SourceEnum_1.SourceEnum.OSM}-${element.properties.osm_id}`,
source: SourceEnum_1.SourceEnum.OSM,
source_id: element.properties.osm_id,
data_provider: "www.openstreetmap.org",
location: element.geometry,
name: element.properties.name,
parking_type: element.properties.parking_structure ? element.properties.parking_structure : "other",
centroid: (0, GeodataHelper_1.getPointOnFeature)(element.geometry),
covered: element.properties.covered ? element.properties.covered === "yes" : null,
security: element.properties.supervised ? element.properties.supervised === "yes" : null,
contact: element.properties.email || element.properties.phone || element.properties.website
? {
email: element.properties.email ?? null,
phone: element.properties.phone ?? null,
website: element.properties.website ?? null,
}
: null,
date_modified: this.transformationDate.toISOString(),
total_spot_number: null,
max_vehicle_dimensions: null,
parking_policy: element.properties.parking_policy ?? null,
active: true,
};
return transformed;
};
}
}
exports.OsmParkingTransformation = OsmParkingTransformation;
//# sourceMappingURL=OsmParkingTransformation.js.map