Hi all, Any clue? Or any documentation I can refer to?
Here goes a dummy example to better explain myself: in QGIS I can click a point (coordinates) of the geotiff and get the value in that point (in this case 231 of Band 1). [image: image.png] Thanks, On Sun, 15 Jan 2023 at 16:17, Pedro Mano Fernandes <[email protected]> wrote: > Hi Jia, > > Thanks for the fast response. > > With the regular spatial join I’ll get the array of data of the whole > geotiff polygon. I was hoping to get the data element for specific > coordinates inside that polygon. In other words: I guess the array of data > corresponds to all the positions in the polygon, but I want to fetch > specific positions. > > Thanks, > > On Sun, 15 Jan 2023 at 01:09, Jia Yu <[email protected]> wrote: > >> 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 >>> >> -- > Pedro Mano Fernandes > -- Pedro Mano Fernandes
