I tried many things without success and I am keen to stop installing more libraries
I loaded a grid
G = gmtread("/GIS/g2015_pga.tif")
G
100Γ100Γ1 Raster{Float32,3} with dimensions:
X Projected LinRange{Float64}(-1.7754e5, 6.10362e5, 100) ForwardOrdered Regular Intervals crs: WellKnownText,
Y Projected LinRange{Float64}(3.37598e6, 2.91423e6, 100) ReverseOrdered Regular Intervals crs: WellKnownText,
Band Categorical 1:1 ForwardOrdered
with missingval: 0.0
I have a CSV file with columns for x coordinates and y coordinates (Β± 7 millions Float points)
How can I extract the Raster value for all those points?
julia> pts
BoundingBox: [-177472.06767, 617812.376218, 2.914211052193e6, 3.36171579452e6]
Error showing value of type GMTdataset{Float64, 2}:
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Symbol
Not sure what is happening there (I tried without the header but it didnβt work)β¦
More than often my CSV have a lot of attributes attached to them that I load in a DataFrame (df).
GMT.jl version 0.43.1 just got merged so please update first. The error
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Symbol
is coming from prettytables and you can ignore it, but it should be gone in latest version. If I put those 5 points in a file (with or without a #x,y comment line) it works fine (ignore also the warning. Must see why itβs happening)
For more complex CSV files you may need to use the CSV/DataFrames packages but at the end you must pass a simple Matrix (not a Tuple) to the grdtrack module. It accepts both matrices or GMTdataset types.
Warning 1: PROJ: proj_create_from_database: C:\Program Files\AppJ\PostgreSQL\13\share\contrib\postgis-3.1\proj\proj.db lacks DATABASE.LAYOUT.VERSION.MAJOR / DATABASE.LAYOUT.VERSION.MINOR metadata. It comes from another PROJ installation.
Warning 1: The definition of projected CRS EPSG:32645 got from GeoTIFF keys is not the same as the one from the EPSG registry, which may cause issues during reprojection operations. Set GTIFF_SRS_SOURCE configuration option to EPSG to use official parameters (overriding the ones from GeoTIFF keys), or to GEOKEYS to use custom values from GeoTIFF keys and drop the EPSG code.
Warning 1: PROJ: proj_create_from_database: C:\Program Files\AppJ\PostgreSQL\13\share\contrib\postgis-3.1\proj\proj.db lacks DATABASE.LAYOUT.VERSION.MAJOR / DATABASE.LAYOUT.VERSION.MINOR metadata. It comes from another PROJ installation.
Warning 1: The definition of projected CRS EPSG:32645 got from GeoTIFF keys is not the same as the one from the EPSG registry, which may cause issues during reprojection operations. Set GTIFF_SRS_SOURCE configuration option to EPSG to use official parameters (overriding the ones from GeoTIFF keys), or to GEOKEYS to use custom values from GeoTIFF keys and drop the EPSG code.
It looks like itβs trying to open your file as an image instead of grid (we donβt use much the word raster here because it mixes these two different types)
Two things:
Can you make that file available so I can try to debug the failures cause?
try G = gdlaread( "su30m_nepal_propa_17843_nb_propagations.tif")
help?> gdalread
search: gdalread gdalrasterize gdalwrite gdaltranslate gdalvectortranslate
gdalread(fname::AbstractString, opts=String[]; gdataset=false, kwargs...)
Read a raster or a vector file from a disk file and return the result either as a GMT type (the default) or a GDAL
dataset.
β’ fname: Input data. It can be a file name, a GMTgrid or GMTimage object or a GDAL dataset
β’ opts: List of options. The accepted options are the ones of the gdal_translate utility. This list can be in
the form of a vector of strings, or joined in a simgle string.
β’ gdataset: If set to true forces the return of a GDAL dataset instead of a GMT type.
β’ kwargs: This options accept the GMT region (-R) and increment (-I)
Returns
βββββββββ
A GMT grid/image or a GDAL dataset
So a limits=(....) option is supposed to work (though I have some distant recalls of issues the increment option)