Hi,

I have a (long) csv file with X, Y coordinates and a (long) list of rasters.

I would like to loop through the rasters, extract the values of the raster at the X, Y locations and write the results in a new CSV each time.

Any chance I can do that using Julia?

Thanks

Check this thread for geotiff rasters reading.

Thanks,

I found this:

```
using GeoData, CSV, GBIF
st = GeoStack(WorldClim{BioClim})[Band(1)] |> replace_missing
obs = GBIF.occurrences("scientificName" => "Burramys parvus", "limit" => 300)
# Read all the occurrences
read!(obs)
# use `extract` to get that values for all layers for each observation.
vals = extract(st, map(o -> o.longitude, obs), map(o -> o.latitude, obs))
# output
```

I will try to see how far i go

I tried this (below) but the output is tricky to understand / manipulate - not sure what to make out of it

```
vals = extract(A, 380706.9107400000, 3098724.2625000002)
```

outputs:

1-element GeoArray{UInt32,1} with dimensions:

Band: 1:1 Categorical: Ordered

and reference dimensions:

X: 380700.13223046553 Projected: Ordered Regular Intervals crs: WellKnownText,

Y: 3.098722533405694e6 Projected: Ordered Regular Intervals crs: WellKnownText

0x00003de4

I tried this:

julia> vals[1]

0x00003de4

and this give me the correct value

julia> println(vals[1])

15844

How can I access this value as a varibale then? … might be for another thread

vals[1] must be of an unsigned type which defaults to show as hex. If you prefer to have it as a signed value do `v = Int(vals[1])`

. If unsigned works for you, then simply `v=vals[1]`

.

1 Like