Thanks for the link. I like how they implemented it using a custom metadata class and java.awk.image.Raster. That way the implementation isn't tied to a specific library like geotools.
Some more notes in rasters: * Geotools is the most used library for rasters. Geotools license isn't compatible with Apache. I came across https://sis.apache.org/. It's an apache library for vector and raster geometries. I haven't tried it but hopefully we could use it for raster geometries. Maybe we can even drop Geotools entirely and use Apache SiS for ST_Transform, shapefiles and other stuff where Geotools is used in Sedona today. * Postgis overloads functions for both vector and raster geometries. Like ST_AsBinary(geometry: g1) and ST_AsBinary(raster: r1). Spark doesn't support overloading of functions. I think the current solution with a RS prefix for raster functions in Sedona is fine. That way we could have ST_AsBinary for vector geometries and RS_AsBinary for raster geometries. * There doesn't seem to be a widely accepted standard for raster processing in SQL. I think we would have to look at Postgis and other implementations for guidance. /Martin Den mån 21 nov. 2022 kl 09:34 skrev Jia Yu <[email protected]>: > Hi Martin, > > I think the idea is good. I also didn't find an official Java based WKB > raster implementation. But this thread might be helpful: > > https://gis.stackexchange.com/questions/184094/how-to-insert-raster-in-postgis-from-java-jdbc > > This guy implemented some prototypes... > > Thanks, > Jia > > On Fri, Nov 18, 2022 at 8:26 AM Martin Andersson < > [email protected]> wrote: > > > Hi all, > > > > I have a use case which involves raster geometries. Naturally I would > like > > to use Sedona for that. > > > > The current raster functions operate on arrays of doubles. That means > that > > all the spatial metadata is missing. That makes it impossible to > implement > > anything like what Postgis has: > https://postgis.net/docs/RT_reference.html > > > > Rasters have a position, srid, scale and other attributes that are needed > > for a lot of functions. > > > > If Sedona had a raster type we would have a foundation to build on. Then > > the community could add their favorite raster functions, just like with > > vector functions. > > > > The Sedona raster type could be serialized to "raster WKB" format. It's a > > format invented by Postgis and not an official standard. It just borrows > > the popular name of the proper WKB which is only for vector geometries. > > > > > https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/raster/doc/RFC2-WellKnownBinaryFormat > > > > There are several independent implementations of raster WKB in C, Rust, > > Python etc. But I haven't found a JVM implementation. We could implement > a > > WKBGridCoverageReader and WKBGridCoverageWriter (implementing > > GridCoverageReader and GridCoverageWriter in geotools) and use > GridCoverage > > in our functions. I haven't used raster geometries that much. There might > > be some better options. > > > > What are your thoughts? > > > > //Martin > > > -- Hälsningar, Martin
