[gdal-dev] AREA_OR_POINT vs GDALMD_AREA_OR_POINT

Even Rouault even.rouault at mines-paris.org
Thu May 29 13:14:20 PDT 2014


On Thursday 29 May 2014 20:58:36 Joaquim Luis wrote:
> > 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)

This is what GDALMD_AREA_OR_POINT is supposed to do, although I can imagine 
that not all drivers will set it even if they should.

> 
> > > 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);

Don't do that !!! As I said before "GDALMD_AREA_OR_POINT" as no particular 
meaning within GDAL and is equivalent to a random metadata item. You could 
write as well "FOO".

"GDALMD_AREA_OR_POINT" != GDALMD_AREA_OR_POINT
but
GDALMD_AREA_OR_POINT = "AREA_OR_POINT"

> 
> 
> ----- 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);

On which dataset do you this : a GTiff dataset ? Opened in update mode ?

See :

Original file is AREA_OR_Point = Area

$ gdalinfo byte.tif
Driver: GTiff/GeoTIFF
Files: byte.tif
Size is 20, 20
Coordinate System is:
PROJCS["NAD27 / UTM zone 11N",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.9786982139006,
                AUTHORITY["EPSG","7008"]],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-117],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","26711"]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
Lower Left  (  440720.000, 3750120.000) (117d38'27.92"W, 33d53'29.51"N)
Upper Right (  441920.000, 3751320.000) (117d37'41.48"W, 33d54' 8.71"N)
Lower Right (  441920.000, 3750120.000) (117d37'41.20"W, 33d53'29.75"N)
Center      (  441320.000, 3750720.000) (117d38' 4.70"W, 33d53'49.11"N)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray

# Open it in update mode and set Point

even at even-ThinkPad-L530:~/trunk/gdal$ 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 = gdal.Open('byte.tif', gdal.GA_Update)
>>> ds.SetMetadataItem('AREA_OR_POINT', 'Point')
0
>>> ds = None
>>> 

# This is 'Point' now

even at even-ThinkPad-L530:~/trunk/gdal$ gdalinfo byte.tif
Driver: GTiff/GeoTIFF
Files: byte.tif
Size is 20, 20
Coordinate System is:
PROJCS["NAD27 / UTM zone 11N",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.9786982139006,
                AUTHORITY["EPSG","7008"]],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4267"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-117],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","26711"]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Point
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
Lower Left  (  440720.000, 3750120.000) (117d38'27.92"W, 33d53'29.51"N)
Upper Right (  441920.000, 3751320.000) (117d37'41.48"W, 33d54' 8.71"N)
Lower Right (  441920.000, 3750120.000) (117d37'41.20"W, 33d53'29.75"N)
Center      (  441320.000, 3750720.000) (117d38' 4.70"W, 33d53'49.11"N)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray


-- 
Geospatial professional services
http://even.rouault.free.fr/services.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140529/3466629f/attachment-0001.html>


More information about the gdal-dev mailing list