MapInfo Pro Developers User Group

 View Only
  • 1.  Change the number of decimals in an elevation grid.

    Posted 11-05-2018 12:00

    Hi all knowledgeable people.

    I have been struggling to find a way to change the number of decimals in an elevation grid. Reason is that I want to reduce file size when exporting the mrr/grd to ESRI ASCII Grid. So I want to change from 4 to 2 decimals.

    Is there a way to do this in Advanced?

    Many thanks

    /Johan



  • 2.  RE: Change the number of decimals in an elevation grid.

    Posted 11-05-2018 21:23

    This is a property of an MRR raster, so in theory you could Convert your raster to an MRR with a restricted number of decimals and then Convert the MRR to ArcASCII. Unfortunately, we do not give you access to this property in the Convert operation.

    You can do it manually with the Calculator operation. Use this formula -

    floor(I1*pow(10,2) + 0.5)/pow(10,2)

    In this formula "I1" is the input grid value and "2" is the number of decimal points you want to preserve in the data. The result is rounded to the nearest value so 3.2347 rounds to 3.23 and 3.2384 rounds to 3.24. You could output this straight to ArcASCII from the Calculator. Unfortunately, this doesn't quite work either because floating point numbers don't play nicely and when you output to ArcASCII you often find you don't have 3.23 but 3.299984 instead (or something). The results may vary depending on the magnitude of your elevation data so it is worth a try.

     

     

     



  • 3.  RE: Change the number of decimals in an elevation grid.

    Posted 11-06-2018 03:35

    Hi Sam!

    Thanks for the detailed and good feedback. I will have a go at that, and see how it works.

    Well yes I noticed that when choosing ordinary ASCII in the export funcion, I am able to define the number of decimals.

    Thanks

    /Johan