<div dir="ltr">I should also have added that original nc has data in Lat Lon, but is not actually stamped with EPSG:4326 SRS. Here is what I get from gdalinfo.<div>(I used a tool called grdcut to create the sample, but the behaviour is same<br><div><br></div><div>This is what gdalinfo shows on original nc file from which I created a sample test case.</div><div><br></div><div><br></div><div>Driver: netCDF/Network Common Data Format<br>Files: /tmp/<a href="http://a.nc">a.nc</a><br>Size is 14401, 6001<br>Origin = (-128.000416666666666,49.000416666666666)<br>Pixel Size = (0.000833333333333,-0.000833333333333)<br>Metadata:<br>  NC_GLOBAL#Conventions=CF-1.4<br>  NC_GLOBAL#geospatial_lat_max=49<br>  NC_GLOBAL#geospatial_lat_min=44<br>  NC_GLOBAL#geospatial_lat_resolution=0.000833<br>  NC_GLOBAL#geospatial_lat_units=degrees_north<br>  NC_GLOBAL#geospatial_lon_max=-116<br>  NC_GLOBAL#geospatial_lon_min=-128<br>  NC_GLOBAL#geospatial_lon_resolution=0.000833<br>  NC_GLOBAL#geospatial_lon_units=degrees_east<br>  NC_GLOBAL#GMT_version=4.5.1 [64-bit]<br>  NC_GLOBAL#history=xyz2grd -R-128/-116/44/49 -I3c -Gcrm_v8.grd<br>  NC_GLOBAL#title=crm_v8.grd<br>  x#actual_range={-128,-116}<br>  x#long_name=x<br>  x#units=degrees_east<br>  x#_CoordinateAxisType=Lon<br>  y#actual_range={44,49}<br>  y#long_name=y<br>  y#units=degrees_north<br>  y#_CoordinateAxisType=Lat<br>  z#actual_range={-3114.800048828125,4348}<br>  z#long_name=z<br>  z#positive=up<br>  z#units=meters<br>  z#_FillValue=-nan<br>Corner Coordinates:<br>Upper Left  (-128.0004167,  49.0004167) <br>Lower Left  (-128.0004167,  43.9995833) <br>Upper Right (-115.9995833,  49.0004167) <br>Lower Right (-115.9995833,  43.9995833) <br>Center      (-122.0000000,  46.5000000) <br>Band 1 Block=14401x1 Type=Float32, ColorInterp=Undefined<br>  NoData Value=nan<br>  Unit Type: meters<br>  Metadata:<br>    actual_range={-3114.800048828125,4348}<br>    long_name=z<br>    NETCDF_VARNAME=z<br>    positive=up<br>    units=meters<br>    _FillValue=-nan<br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 7, 2024 at 10:06 AM B H <<a href="mailto:hemantbist@gmail.com">hemantbist@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I am trying to reproject a netCDF file which is in Lat Lon (EPSG:4326) projection to EPSG:3857 (Google mercator) (on GDAL 3.4.3, released 2022/04/22).<div><div>If I reproject to a tif file, it is reprojected correctly. If I reproject to a nc file it reproject incorrectly/different location that tif file. I am giving the commands I ran below.</div><div>Correctness is determined by viewing them in QGIS: (All tif files show up at exactly same location as   <a href="http://a_stamped_latlon.nc" target="_blank">a_stamped_latlon.nc</a>. <a href="http://agoog.nc" target="_blank">agoog.nc</a> show up at a different location ).</div><div><br></div><div>I will be happy to post the sample files [The only way I know to send files to open a bug, but very likely its some details I don't know about different formats].: <a href="http://a.nc" target="_blank">a.nc</a> is only 42KB.</div><div><br></div><div>Here is how to reproduce it.</div><div><br></div><div> gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 -co COMPRESS=DEFLATE -r cubic <a href="http://a.nc" target="_blank">a.nc</a> <a href="http://agoog.nc" target="_blank">agoog.nc</a><br></div><div>gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 -co COMPRESS=DEFLATE -r cubic -co "GEOTIFF_KEYS_FLAVOR=STANDARD" agoog_std.tif<br></div><div>gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 -co COMPRESS=DEFLATE -r cubic -co "GEOTIFF_KEYS_FLAVOR=STANDARD" <a href="http://a.nc" target="_blank">a.nc</a>  agoog_std.tif<br></div><div><br></div><div>gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 -co COMPRESS=DEFLATE -r cubic -co "GEOTIFF_KEYS_FLAVOR=ESRI_PE" <a href="http://a.nc" target="_blank">a.nc</a>  agoog_esri.tif<br></div><div>gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 -co COMPRESS=DEFLATE -r cubic -co "GEOTIFF_KEYS_FLAVOR=STANDARD" <a href="http://a.nc" target="_blank">a.nc</a>  agoog_std.tif<br></div><div>gdal_translate -a_srs EPSG:4326 <a href="http://a.nc" target="_blank">a.nc</a> <a href="http://a_stamped_latlon.nc" target="_blank">a_stamped_latlon.nc</a><br></div><div><br></div><div><br>GDAL 3.4.3, released 2022/04/22<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div>
</blockquote></div>