gama-platform / gama

Main repository for developing the 2024+ versions of GAMA
https://gama-platform.org
GNU General Public License v3.0
12 stars 5 forks source link

Saving ASC files with the wrong extension produces strange results #151

Closed AlexisDrogoul closed 3 weeks ago

AlexisDrogoul commented 3 months ago

To reproduce Run the model named Save to ASC.gaml in the library. The ASC file is correctly saved.

Now replace save cell to:"../results/grid.asc"; by save cell format:"asc" to:"../results/grid.data";, which should normally produce the same outcome (except in a .data file), and open the resulting file :

PROJCS["WGS 84 / UTM zone 48N", 
  GEOGCS["WGS 84", 
    DATUM["World Geodetic System 1984", 
      SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], 
      AUTHORITY["EPSG","6326"]], 
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
    UNIT["degree", 0.017453292519943295], 
    AXIS["Geodetic longitude", EAST], 
    AXIS["Geodetic latitude", NORTH], 
    AUTHORITY["EPSG","4326"]], 
  PROJECTION["Transverse_Mercator"], 
  PARAMETER["central_meridian", 105.0], 
  PARAMETER["latitude_of_origin", 0.0], 
  PARAMETER["scale_factor", 0.9996], 
  PARAMETER["false_easting", 500000.0], 
  PARAMETER["false_northing", 0.0], 
  UNIT["m", 1.0], 
  AXIS["Easting", EAST], 
  AXIS["Northing", NORTH], 
  AUTHORITY["EPSG","32648"]]

Expected behavior That specifying the format as asc overrides the extension of the file.

lesquoyb commented 3 months ago

To add more context, here is what happens when there's a mismatch between the format and the extension:

Also the result you get seems to be the same as if it were saved as a geotiff

AlexisDrogoul commented 3 months ago

I have committed a possible fix -- but only tested it with the asc + data combination. Please tell if it solves the other problems too !

lesquoyb commented 2 months ago

I don't know if it's the result of this fix or if it was something already present, but I noticed that saving the cell in png with png extension result in a new png file but also a prj file. Is that an expected behaviour?