|
@@ -39,9 +39,10 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS,
|
|
|
OGRSpatialReferenceH hSRS;
|
|
|
|
|
|
hSRS = OSRNewSpatialReference(wkt);
|
|
|
- GPJ_osr_to_grass(cellhd, &proj_info, &proj_units, hSRS, 0);
|
|
|
+ if (hSRS != NULL)
|
|
|
+ GPJ_osr_to_grass(cellhd, &proj_info, &proj_units, hSRS, 0);
|
|
|
|
|
|
- if (!OSRIsProjected(hSRS) && !OSRIsGeographic(hSRS)) {
|
|
|
+ if (!hSRS || (!OSRIsProjected(hSRS) && !OSRIsGeographic(hSRS))) {
|
|
|
G_important_message(_("Input contains an invalid SRS. "
|
|
|
"WKT definition:\n%s"), wkt);
|
|
|
|
|
@@ -59,7 +60,7 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS,
|
|
|
if (authname && *authname && strcmp(authname, "EPSG") == 0) {
|
|
|
authcode = OSRGetAuthorityCode(hSRS, authkey);
|
|
|
if (authcode && *authcode) {
|
|
|
- G_debug(0, "found EPSG:%s", authcode);
|
|
|
+ G_debug(1, "found EPSG:%s", authcode);
|
|
|
proj_epsg = G_create_key_value();
|
|
|
G_set_key_value("epsg", authcode, proj_epsg);
|
|
|
}
|