Adding o-module-mapping:feature to item add api call

I’m currently trying to modify the OAI-PMH Harvester module to allow ingest of MARC21 recordst. As part of this I’m attempting to add an o-module-mapping:feature to add a geolocation point to the records.

The CSVImport extension within the Mapping module appears to do this via:

                $json['o-module-mapping:feature'][] = [
                    'o-module-mapping:geography-type' => 'point',
                    'o-module-mapping:geography-coordinates' => [$latLng[1], $latLng[0]],
                ];

And so in an attempt to recreate this, I’m mapping the 970 x and y coordinates in a similar way:

$json[‘o-module-mapping:feature’] = [
‘o-module-mapping:geography-type’ => ‘point’,
‘o-module-mapping:geography-coordinates’ => [$lng, $lat],
];

What’s the proper way to go about this?

1 Like

What version of Mapping are you using?

If you’re using a Mapping version prior to 2.0, the correct format is:

$json['o-module-mapping:marker'][] = [
    'o-module-mapping:lat' => $lat,
    'o-module-mapping:lng' => $lng,
    'o-module-mapping:label' => $label,
]

2.0.0 but I’m not necessarily married to that. Would it be the same for 2.0.0?

Turns out I was doing it fine, there was just a small bug in my code! Thanks all!