hello everyone, wondering if we have `st_setsrid` ...
# general
c
hello everyone, wondering if we have
st_setsrid
like function in crdb to change the spatial reference system?
k
dont think its available. I know H3 library thats used supports it. so, it might be a simple udf to support it cc @User something as simple as adding this to ScalarFunctions.java or overloading the existing functions to take srid as additional parameter
Copy code
@ScalarFunction
  public static byte[] setSRID(byte[] bytes, int srid) {
    Geometry geometry = GeometrySerializer.deserialize(bytes);
    geometry.setSRID(srid);
    return GeometrySerializer.serialize(geometry);
  }
c
gotcha. is our default spatial reference system id
4326
?
y
Yes, it's 4326
Adding this func is easy, the hard part is that the serialization does not store it today
Serialization today uses 1 bit to differentiate geography vs geometry, but not the general srid to save storage.
It's possible to build an extension to this, though
c
got it. thanks.