@@ -54,7 +54,15 @@ int main( int argc, char **argv )
54
54
55
55
name = map -> answer ;
56
56
57
- G_get_window ( & window );
57
+ /* Make sure map is available */
58
+ mapset = G_find_cell2 ( name , "" );
59
+ if ( mapset == NULL )
60
+ G_fatal_error (( "Raster map <%s> not found" ), name );
61
+
62
+ /* It can happen that GRASS data set is 'corrupted' and zone differs in WIND and
63
+ * cellhd, and G_open_cell_old fails, so it is better to read window from map */
64
+ /* G_get_window( &window ); */
65
+ G_get_cellhd ( name , mapset , & window );
58
66
window .west = atof ( win -> answers [0 ] );
59
67
window .south = atof ( win -> answers [1 ] );
60
68
window .east = atof ( win -> answers [2 ] );
@@ -64,12 +72,6 @@ int main( int argc, char **argv )
64
72
G_adjust_Cell_head ( & window , 1 , 1 );
65
73
G_set_window ( & window );
66
74
67
- /* Make sure map is available */
68
- mapset = G_find_cell2 ( name , "" );
69
- if ( mapset == NULL )
70
- G_fatal_error (( "Raster map <%s> not found" ), name );
71
-
72
-
73
75
fp = G_raster_map_is_fp ( name , mapset );
74
76
75
77
/* use DCELL even if the map is FCELL */
0 commit comments