[gdal-dev] AREA_OR_POINT vs GDALMD_AREA_OR_POINT
Even Rouault
even.rouault at mines-paris.org
Thu May 29 14:08:46 PDT 2014
>
> Glad to not do, but than I'm left with nothing. If I do instead as you say
>
> GDALSetMetadataItem(hDstDS, GDALMD_AREA_OR_POINT, "Point", NULL);
>
> which than equivalent to
>
> GDALSetMetadataItem(hDstDS, "AREA_OR_POINT", "Point", NULL);
>
> than, as I showed before and contrary to your python examples, the
> GDALSetMetadataItem() is not working in our code.
>
> > On which dataset do you this : a GTiff dataset ? Opened in update mode ?
>
> No, not update mode. It's dataset filled an empty MEM. See (lines #167
> and after)
>
> http://gmtrac.soest.hawaii.edu/projects/gmt/repository/entry/branches/5.2.0/
> src/gmt_gdalwrite.c
Well, I suppose that your local copy of the code use GDALMD_ARE_OR_POINT
unquoted...
I've tried a simplified version of your code and it works for me. Do you use a
recent enough version of GDAL ?
from osgeo import gdal
from osgeo import osr
mem_ds = gdal.GetDriverByName('Mem').Create('mem', 1, 1)
mem_ds.SetGeoTransform([10,1,0,100,0,-1])
sr = osr.SpatialReference()
sr.ImportFromEPSG(32631)
mem_ds.SetProjection(sr.ExportToWkt())
mem_ds.SetMetadataItem('AREA_OR_POINT', 'Point')
gtiff_ds = gdal.GetDriverByName('GTiff').CreateCopy('out.tif', mem_ds)
gtiff_ds = None
Note: for AREA_OR_POINT to be taken into account in GeoTiff, you need to define
both a geotransform and a SRS.
$ gdalinfo out.tif
Driver: GTiff/GeoTIFF
Files: out.tif
Size is 1, 1
Coordinate System is:
PROJCS["WGS 84 / UTM zone 31N",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",3],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","32631"]]
Origin = (10.000000000000000,100.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
AREA_OR_POINT=Point
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 10.000, 100.000) ( 1d29'19.16"W, 0d 0' 3.25"N)
Lower Left ( 10.000, 99.000) ( 1d29'19.16"W, 0d 0' 3.21"N)
Upper Right ( 11.000, 100.000) ( 1d29'19.12"W, 0d 0' 3.25"N)
Lower Right ( 11.000, 99.000) ( 1d29'19.12"W, 0d 0' 3.21"N)
Center ( 10.500, 99.500) ( 1d29'19.14"W, 0d 0' 3.23"N)
Band 1 Block=1x1 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/378cd8bb/attachment.html>
More information about the gdal-dev
mailing list