Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HFA: enable to read GCPs from PAM .aux.xml (fixes #4591) #4607

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions autotest/gcore/hfa_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import pytest

from osgeo import gdal
from osgeo import gdal, osr

import gdaltest

Expand Down Expand Up @@ -430,4 +430,22 @@ def test_hfa_create_compress_big_block():
assert got_data == src_ds.GetRasterBand(1).ReadRaster()



# GCPs go to PAM currently
def test_hfa_create_gcp():
filename = '/vsimem/test.img'
ds = gdal.GetDriverByName('HFA').Create(filename, 1, 1)
gcp1 = gdal.GCP()
gcp1.GCPPixel = 0
gcp1.GCPLine = 0
gcp1.GCPX = 440720.000
gcp1.GCPY = 3751320.000
sr = osr.SpatialReference()
sr.ImportFromEPSG(4326)
assert ds.SetGCPs((gcp1, ), sr.ExportToWkt()) == gdal.CE_None
ds = None
ds = gdal.Open(filename)
assert ds.GetGCPCount() == 1
assert ds.GetGCPSpatialRef() is not None
assert len(ds.GetGCPs()) == 1
ds = None
gdal.GetDriverByName('HFA').Delete(filename)
2 changes: 1 addition & 1 deletion gdal/frmts/hfa/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ clean:
$(O_OBJ): hfa.h hfa_p.h

hfatest: hfatest.$(OBJ_EXT) $(HFAOBJ:.o=.$(OBJ_EXT))
$(LD) hfatest.$(OBJ_EXT) $(HFAOBJ:.o=.$(OBJ_EXT)) ../../port/*.$(OBJ_EXT) ../../ogr/ogrsf_frmts/o/json_*.o ../../ogr/ogrsf_frmts/o/printbuf.o ../../ogr/ogrsf_frmts/o/arraylist.o ../../ogr/ogrsf_frmts/o/linkhash.o ../../ogr/ograpispy.o -L../.. -lgdal $(LIBS) -o hfatest
$(LD) hfatest.$(OBJ_EXT) $(HFAOBJ:.o=.$(OBJ_EXT)) ../../port/*.$(OBJ_EXT) ../../ogr/ogrsf_frmts/o/json_*.o ../../ogr/ogrsf_frmts/o/printbuf.o ../../ogr/ogrsf_frmts/o/arraylist.o ../../ogr/ogrsf_frmts/o/linkhash.o ../../ogr/ograpispy.o ../../ogr/ogr_proj_p.o -L../.. -lgdal $(LIBS) -o hfatest

install-obj: $(O_OBJ:.o=.$(OBJ_EXT))
8 changes: 6 additions & 2 deletions gdal/frmts/hfa/hfa_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#include "cpl_error.h"
#include "cpl_vsi.h"
#include "ogr_spatialref.h"

#ifdef CPL_LSB
# define HFAStandard(n,p) {}
Expand Down Expand Up @@ -135,12 +136,15 @@ HFACreateLayer( HFAHandle psInfo, HFAEntry *poParent,
GIntBig nStackDataOffset,
int nStackCount, int nStackIndex );

char *
HFAPCSStructToWKT( const Eprj_Datum *psDatum,
std::unique_ptr<OGRSpatialReference>
HFAPCSStructToOSR( const Eprj_Datum *psDatum,
const Eprj_ProParameters *psPro,
const Eprj_MapInfo *psMapInfo,
HFAEntry *poMapInformation );

const char *const* HFAGetDatumMap();
const char *const* HFAGetUnitMap();

/************************************************************************/
/* HFABand */
/************************************************************************/
Expand Down
Loading