h2gis
h2gis copied to clipboard
ST_MemSize
Implement ST_MemSize as PostGIS does to help people to know the memory size of the Geometry
https://postgis.net/docs/ST_MemSize.html
Fixed.
I think you should change argument of this function from Geometry
to Value
to avoid expensive conversion to Geometry
and back and use its octetLength()
method. Nulls are passed as ValueNull.INSTANCE
in that case.
Thanks
So ST_MenSize will return the size of any value. Right ?
You can check its type by yourself and throw an exception if it isn't a geometry, or you can force conversion to ValueGeometry
:
return v == ValueNull.INSTANCE ? null : v.convertToGeometry(null).octetLength() + SOME_EXTRA_BYTES;