Hi Pedro,

Once you use Sedona geotiff reader to read those geotiffs, you will get a
dataframe with the following schema:

 |-- image: struct (nullable = true)
 |    |-- origin: string (nullable = true)
 |    |-- Geometry: string (nullable = true)
 |    |-- height: integer (nullable = true)
 |    |-- width: integer (nullable = true)
 |    |-- nBands: integer (nullable = true)
 |    |-- data: array (nullable = true)
 |    |    |-- element: double (containsNull = true)


You can use the following way to fetch the geometry column and perform the
spatial join;

geotiffDF = geotiffDF.selectExpr("image.origin as
origin","ST_GeomFromWkt(image.geometry) as Geom", "image.height as height",
"image.width as width", "image.data as data", "image.nBands as bands")
geotiffDF.createOrReplaceTempView("GeotiffDataframe")
geotiffDF.show()

More info can be found:
https://sedona.apache.org/1.3.1-incubating/api/sql/Raster-loader/#geotiff-dataframe-loader

Thanks,
Jia

On Sat, Jan 14, 2023 at 9:10 AM Pedro Mano Fernandes <[email protected]>
wrote:

> Hi everyone!
>
> I'm trying to use elevation data in GeoTiff format. I understand how to
> load the dataset, as described in
>
> https://sedona.staged.apache.org/api/sql/Raster-loader/#geotiff-dataframe-loader
> .
> Now I'm wondering how to join this dataframe with another one that contains
> coordinates, in order to get the elevation data for those coordinates.
>
> Something along these lines:
>
> pointsDF
>   .join(geotiffDF, ...)
>   .select("lon", "lat", "geotiff_data")
>
> Are there any examples or documentation I can follow to accomplish this?
>
> Thanks,
>
> --
> Pedro Mano Fernandes
>

Reply via email to