@Override
public void serialize(Point value, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
String crsType = value.getCRS().getType();
List<Double> coordinate = value.getCoordinate().getCoordinate();
if (crsType.startsWith(CoordinateReferenceSystem.Cartesian.toString())) {
if (coordinate.size() == 3) {
jsonGenerator.writeObject(new PointCartesian(crsType, coordinate.get(0), coordinate.get(1), coordinate.get(2)));
} else {
jsonGenerator.writeObject(new PointCartesian(crsType, coordinate.get(0), coordinate.get(1)));
}
} else {
if (coordinate.size() == 3) {
jsonGenerator.writeObject(new PointWgs(crsType, coordinate.get(0), coordinate.get(1), coordinate.get(2)));
} else {
jsonGenerator.writeObject(new PointWgs(crsType, coordinate.get(0), coordinate.get(1)));
}
}
}