Skip to content

Commit

Permalink
fix an issue of specifying CRS when saveas
Browse files Browse the repository at this point in the history
When there is no projection information of current dataset (e.g. no .prj file, or create points from a csv table), specifying CRS when exporting to a vector data format doesn't generate a .prj file or related projection information.
  • Loading branch information
lixun910 committed Oct 15, 2019
1 parent 19fc204 commit 547302a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions DialogTools/ExportDataDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,15 @@ ExportDataDlg::CreateOGRLayer(wxString& ds_name, bool is_table,
new_ref.importFromEPSG(4326);
valid_input_crs = true;
}
if (spatial_ref && (valid_input_crs && !spatial_ref->IsSame(&new_ref))) {
OGRCoordinateTransformation *poCT;
poCT = OGRCreateCoordinateTransformation(spatial_ref, &new_ref);
for (size_t i=0; i < ogr_geometries.size(); i++) {
ogr_geometries[i]->transform(poCT);
if (ogr_geometries.size() > 0 && valid_input_crs) {
if (spatial_ref && spatial_ref->IsSame(&new_ref) == false) {
// transform geometries from old CRS to new CRS
OGRCoordinateTransformation *poCT;
poCT = OGRCreateCoordinateTransformation(spatial_ref, &new_ref);
for (size_t i=0; i < ogr_geometries.size(); i++) {
ogr_geometries[i]->transform(poCT);
}
OGRCoordinateTransformation::DestroyCT(poCT);
}
spatial_ref = &new_ref; // use new CRS
}
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Gda {
const int version_subbuild = 2;
const int version_year = 2019;
const int version_month = 10;
const int version_day = 10;
const int version_day = 15;
const int version_night = 0;
const int version_type = 2; // 0: alpha, 1: beta, 2: release
}

0 comments on commit 547302a

Please sign in to comment.