[gdal-dev] Raster origin coodinates in file header

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Raster origin coodinates in file header

Adrien ANDRÉ
Dear list,

opening 2 rasters with different resolutions i noticed a shift.

Asking our imagery provider, i was told the origin coordinates they
store in image header (JP2 files) are those of the top left pixel center.

GDAL reads origin coordinates as the top left pixel top left corner
coordinates, as i'm used to.


Of course, i fixed my problem, the hacky way, playing with
gdal_translate a_ullr option, but:

How to deal with this?
How not to worry about georeferencing each time i load a raster file?
Is there any OGC recommendation about origin coordinates storage?


Thanking you in advance,

Regards,

Adrien
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Raster origin coodinates in file header

Even Rouault-2
Adrien,

> opening 2 rasters with different resolutions i noticed a shift.
>
> Asking our imagery provider, i was told the origin coordinates they
> store in image header (JP2 files) are those of the top left pixel center.
>
> GDAL reads origin coordinates as the top left pixel top left corner
> coordinates, as i'm used to.
>
>
> Of course, i fixed my problem, the hacky way, playing with
> gdal_translate a_ullr option, but:
>
> How to deal with this?

Normally, if the image provider did its job correctly, GDAL should report a
consistant georeferencing in its convention (top left corner of top left pixel
is 0,0), doing half pixel shift if needed.

There are 2 ways of encoding georeferencing in JPEG2000:
- GMLJP2, which has a convention of center of top left pixel. GDAL adds a half
pixel shift to translate into its convention
- GeoJP2 (GeoTIFF-in-JPEG2000), which in most cases, uses the pixel-is-area
convention, which is the same as GDAL. In rare cases, it could be pixel-is-
center, in which case recent versions of GDAL (1.11 perhaps, 2.0 for sure),
will translate to GDAL convention.

Both can be present in a same file, in which case GDAL will use GeoJP2
contents.

So if you're seeing a half pixel shift, either there's a remaining bug in GDAL
(not sure where), either the image provider didn't encode it correctly

> How not to worry about georeferencing each time i load a raster file?
> Is there any OGC recommendation about origin coordinates storage?

GMLJP2 mentions it. GMLJP2 v1 wasn't completely clear about that, but the
language of GMLJP2 v2 has clarified it.

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev