BikeHireDockingStation (GeoJSON)

This example demonstrates how to transform a GeoJSON file containing Milan’s bike docking stations with geographic coordinates into FIWARE-compliant NGSI-LD entities.

Source Data

The source data follows the standard GeoJSON FeatureCollection format with Point geometries. Each feature has properties such as:

  • ID — Unique identifier

  • BIKE_SH — Station name/identifier

  • INDIRIZZO — Street address

  • ANNO — Installation year

  • STALLI — Number of bike stalls

  • LOCALIZ — Location type

Mapping Configuration

Geometry Handling

Access properties via properties.field_name and geometry via geometry. Preserve GeoJSON Point geometry directly:

location: {
    source: "{{ geometry }}",
    type: "GeoProperty",
    transformation: "geometry",
}

Date Construction

Build a complete datetime from a year field:

dateCreated: {
    source: "{{ properties.ANNO }}-01-01T00:00:00Z",
    type: "Property",
    transformation: "datetime",
}

Nested Address

address: {
    type: "Property",
    transformation: "object",
    mappings: {
        streetAddress: {
            source: "{{ properties.INDIRIZZO }}",
            type: "Property",
            transformation: "string",
        },
        addressLocality: { source: "Milano", type: "Property", transformation: "string" },
        addressCountry: { source: "IT", type: "Property", transformation: "string" },
    },
}

Running the Example

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

Key Takeaways

  • Access GeoJSON properties via properties.field_name and geometry via geometry

  • Use transformation: "geometry" to preserve spatial data integrity

  • Use mappings to create structured objects from flat properties

  • Build complete dates from partial date information