It's a pity that the original
> registration type is not preserved in GDAL so we could respect it.
Is not preserved : through which operations ?
Through some form of metadata that would inform us that:
"Although I'm reporting cell corner coordinates this file was
originally using cell center" (example case: Golden Software, AKA Surfer
format)
> So let me repeat one of my previous questions, why was this ignored?
>
> GDALSetMetadataItem(hDstDS, "AREA_OR_POINT", "Point", NULL);
What do you mean by "ignored" ? Self-contained reproducable use case
please ;-) I don't read in your mind.
Sorry that you can't.
I can't refer to a 5 liner example so I'll have to show some printings.
When I use
GDALSetMetadataItem(hDstDS, "GDALMD_AREA_OR_POINT", "Point", NULL);
----- From GMT convert from netCDF to GeoTiff -----
grdreformat smt.grd lixo_MD_Pt.tiff=gd:GTiFF
Now gdalinfo shows "GDALMD_AREA_OR_POINT=Point"
gdalinfo lixo_MD_Pt.tiff
Driver: GTiff/GeoTIFF
Files: lixo_MD_Pt.tiff
Size is 256, 256
Coordinate System is `'
Origin = (-128500.000000000000000,127500.000000000000000)
Pixel Size = (1000.000000000000000,-1000.000000000000000)
Metadata:
GDALMD_AREA_OR_POINT=Point
<================================================
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( -128500.000, 127500.000)
Lower Left ( -128500.000, -128500.000)
Upper Right ( 127500.000, 127500.000)
Lower Right ( 127500.000, -128500.000)
Center ( -500.000, -500.000)
Band 1 Block=256x8 Type=Float32, ColorInterp=Gray
Min=-5000.000 Max=-1249.000
Minimum=-5000.000, Maximum=-1249.000, Mean=-4941.563, StdDev=395.981
NoData Value=nan
Metadata:
STATISTICS_MAXIMUM=-1249
STATISTICS_MEAN=-4941.5626603216
STATISTICS_MINIMUM=-5000
STATISTICS_STDDEV=395.98068901299
However, if I do instead
GDALSetMetadataItem(hDstDS, "AREA_OR_POINT", "Point", NULL);
grdreformat smt.grd lixo_MD_Pt2.tiff=gd:GTiFF
Than gdalinfo shows nothing in what regards the AREA_OR_POINT metadata.
This is what I was referring as "Ignored"
gdalinfo lixo_MD_Pt2.tiff
Driver: GTiff/GeoTIFF
Files: lixo_MD_Pt2.tiff
Size is 256, 256
Coordinate System is `'
Origin = (-128000.000000000000000,127000.000000000000000)
Pixel Size = (1000.000000000000000,-1000.000000000000000)
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( -128000.000, 127000.000)
Lower Left ( -128000.000, -129000.000)
Upper Right ( 128000.000, 127000.000)
Lower Right ( 128000.000, -129000.000)
Center ( 0.000, -1000.000)
Band 1 Block=256x8 Type=Float32, ColorInterp=Gray
Min=-5000.000 Max=-1249.000
Minimum=-5000.000, Maximum=-1249.000, Mean=-4941.563, StdDev=395.981
NoData Value=nan
Metadata:
STATISTICS_MAXIMUM=-1249
STATISTICS_MEAN=-4941.5626603216
STATISTICS_MINIMUM=-5000
STATISTICS_STDDEV=395.98068901299
$ python
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
ds =>>> ds = gdal.GetDriverByName('Mem').Create('', 1, 1)
>>> ds.SetMetadataItem('AREA_OR_POINT', 'Point')
0
>>> ds.GetMetadataItem('AREA_OR_POINT')
'Point'
>
> > Regarding the MEM driver, GDALMD_AREA_OR_POINT is just a random
> > metadata item.
> >
> > Some drivers will set GDALMD_AREA_OR_POINT to the GDALMD_AOP_POINT =
> > "Point" value.
> >
> > And the GTiff driver uses it to determine if it must apply a
> > half-pixel shift between the GDAL convention and the GeoTIFF
convention.
> >
> > Even
> >
> > > Hi,
> > >
> > >
> > >
> > > I made GMT respect as far as possible the AREA_OR_POINT GeoTiff key
> > >
> > > for read/write, but ...
> > >
> > >
> > >
> > > The following was silently ignored (GMT uses the MEM driver)
> > >
> > >
> > >
> > > GDALSetMetadataItem(hDstDS, "AREA_OR_POINT", "Point", NULL);
> > >
> > >
> > >
> > > so digging here and there I found about GDALMD_AREA_OR_POINT, and in
> > >
> > > fact this one is now taken into consideration
> > >
> > >
> > >
> > > GDALSetMetadataItem(hDstDS, "GDALMD_AREA_OR_POINT", "Point", NULL);
> > >
> > >
> > >
> > >
> > >
> > > However, this implies that on reading I have now to test for both
> > >
> > >
> > >
> > > GDALGetMetadataItem(hDataset, "AREA_OR_POINT", NULL)
> > >
> > >
> > >
> > > ---- AND ----
> > >
> > >
> > >
> > > GDALGetMetadataItem(hDataset, "GDALMD_AREA_OR_POINT", NULL)
> > >
> > >
> > >
> > > This means that other codes that pay attention to the AREA vs POINT
> > >
> > > thing will have to do both tests as well and if they do only the
first
> > >
> > > one, GeoTiffs created by GDAL will have the problem ignored, and
quite
> > >
> > > likely an error in coordinates will follow.
> > >
> > >
> > >
> > > So the question is, why this name duplication (AREA_OR_POINT vs
> > >
> > > GDALMD_AREA_OR_POINT) and why GDALSetMetadataItem() ignores the
> > >
> > > AREA_OR_POINT key?
> > >
> > >
> > >
> > > Thanks
> > >
> > > Joaquim
> > >
> > >
> > >
> > > ----------------------------------------------------------------
> > >
> > > This message was sent using IMP, the Internet Messaging Program.
> > >
> > >
> > >
> > > _______________________________________________
> > >
> > > gdal-dev mailing list
> > >
> > > [email protected]
> > >
> > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> > Geospatial professional services
> >
> > http://even.rouault.free.fr/services.html
--
Geospatial professional services
http://even.rouault.free.fr/services.html
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev