Feature(s) impacted
Displaying location fields of type POINT from a PostgreSQL database.
Observed behavior
The location fields in my t_e_merchant_address table appear as null in Forest Admin, despite being correctly stored in the database, as POINT field.
Expected behavior
In the database, the location field values appear correctly as coordinates, e.g., (4.15367839, 0.45678876), but they are displayed as null in Forest Admin.
My sequelize definition:
location: {
type: DataTypes.GEOMETRY('POINT', 4326),
allowNull: true,
get() {
const rawValue = this.getDataValue('location');
if (rawValue && rawValue.coordinates) {
const [lon, lat] = rawValue.coordinates;
return { lat, lon };
}
return null;
},
set(value) {
if (value && value.lat !== undefined && value.lon !== undefined) {
this.setDataValue('location', { type: 'Point', coordinates: [value.lon, value.lat] });
}
}
}
Thank you for your assistance!