OffStreetParking (GeoJSON)

This example demonstrates how to transform a GeoJSON file containing Milan’s off-street parking facilities into FIWARE-compliant NGSI-LD entities. It showcases advanced template features for conditional logic and dynamic categorization.

Source Data

The source data follows GeoJSON FeatureCollection format with Point geometries. Properties include:

  • id — Unique identifier

  • nome — Parking facility name

  • n_posti — Total number of parking spaces

  • indirizzo — Street address

  • comune — Municipality

  • tipo — Parking type category (Italian codes)

Conditional Logic

The parking type (tipo) contains Italian codes that must be translated into standardized FIWARE categories. Use Tera conditional logic:

category: {
    source: "{% if properties.tipo == 'RESIDENTI/PUBBLICI' or properties.tipo == 'PUBBLICI/RESIDENTI' %}publicPrivate{% elif properties.tipo == 'PUBBLICI' %}public{% elif properties.tipo == 'AUTORIMESSA CONVENZIONATA' %}onlyWithPermit{% endif %}",
    type: "Property",
    transformation: "array",
}

Permit Requirement Logic

Different parking types have different permit requirements:

requiredPermit: {
    source: "{% if properties.tipo == 'AUTORIMESSA CONVENZIONATA' %}specificIdentifiedVehiclePermit{% else %}noPermitNeeded{% endif %}",
    type: "Property",
    transformation: "array",
}

Static Array Values

Some attributes require predefined constant arrays:

allowedVehicleType: {
    source: "car",
    type: "Property",
    transformation: "array",
},
occupancyDetectionType: {
    source: ["none", "manual"],
    type: "Property",
    transformation: "array",
}

Running the Example

cassiopeia map geojson -i data/geojson/OffStreetParking.geojson -o output -m data/geojson/OffStreetParking.json5

Key Takeaways

  • Use {% if %} templates for complex data categorization

  • Transform local codes into international standards with conditional logic

  • Define static array values for standard attributes

  • Implement business rules dynamically based on data types