How should I define Spatial field type? I have set of coordinates in EPSG 4326 / WGS84(ie. longitude and latitude in degrees) and I would like to store it as spatial information in DB so that I can perform spatial computations and use spatial indexes.

Currently I have a FieldType item that has longitude and latitude decimals but I would like to extend it and add this type of information. Since FieldType items do provide schema I can define the type via mysql_type/pgsql_type but I am not sure how to tell Drupal to use expression when inserting the value into database since there is no data manipulation available in the FieldType object and I do not see anything as well in DataType(in case I would create a new one instead of using string).

Looking ad DB drivers, I do not see anything particular that would need me to create my own version so I think this should be handled by the FieldType somehow but am not sure how.
This does not answer the question exactly but: it is possible to create the field simply by using proper schema BUT the issue is writing and reading data. It is possible with \Drupal::database()-&gt;query() but not with \Drupal::database()-&gt;select() or any other method since we have no control over value escaping so spatial functions are not interpreted.