Welcome, Guest
Username: Password: Remember me

TOPIC: Map Objects with ascii grid: interpolation method?

Map Objects with ascii grid: interpolation method? 2 years 7 months ago #39160

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
Thanks for the reminder! I have not addressed this particular issue, so likely it has not changed from what you observed before.

For such things (i.e. no one is directly paying for the work and the work has the potential to break things elsewhere in the code) then they tend to take a long time to look into. I focus on the work that I'm paid to produce (as we all do I'm sure!) and try to focus on issues that will garner fixes in multiple places (e.g. attributes, class hierarchy, workspaces, etc).

That being said, please keep checking back with me... I'll do my best with the time I have available to sort something out for this particular issue.

Kindly,
Alan
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40847

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
Ok... finally getting to this. Thanks for your patience :)

Here is a screen snapshot of the files shared by pilou1253

2022-08-23_BK_ImportASCgrid.png


As we can see, the grid's lower left hand corner is being placed exactly as described in the header of the ASC file.

Now, the grid values may be associated with the nodes (e.g. the same as what Blue Kenue's Rect 2D Scalar does) or the grid values may be associated with the cells (e.g. the same as what Blue Kenue's Rect 2D Cell does). I see 2 options:
  • Continue to import the ASC grid as a Rect 2D Scalar AND provide an option to decide about the shifting
  • Add support to import the ASC grid as either a Rect 2D Scalar OR a Rect 2D Cell... the latter being what seems to be needed by pilou1253

Thoughts?

Kindly,
Alan
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40848

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
Actually, I see in the code that changing xllcorner to xllcenter would likely be the correct thing to do. I suggest that you create your ASC file with the correct definition and then Blue Kenue will be able to correctly import it for you.

2022-08-23_BK_ImportASCgrid2.png


Agree?

Kindly,
Alan
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40849

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
I do see a bug related to the min value in the Data tab... I will investigate that issue and fix it.
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40850

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
Ok... the min value is now correctly computed AND because of another fix in my development version, the colour scale is correctly displayed (no need to press reset after importing the ASC grid).

2022-08-23_BK_ImportASCgrid_minBugFixed.png


I think I'll release a new Blue Kenue version this afternoon. Lots of fixes and a few new features added lately...

Kindly,
Alan
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40858

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 582
  • Thank you received: 105
Hi Alan!

Thank you for looking into this!
I read all the messages you posted earlier today but only reply to this one. Yes, until now I have been working with ascii rasters in BK by shifting them with +cellsize/2 manually (xllcorner and yllcorner). This works perfectly, but only because I am aware of the XY datum shift issue ;) I am sure that a lot of users are not.

I think it would be better to use one of the two methods you mentionned above, with a preference for the first one: letting the user decide whether a shift is to be applied or not. It can also be good to mention that applying the shift garantees that the raster will be cell-centered ie. same definition as what is usually used in GIS packages.

What do you think?

Kind regards,
PL

PS: in case there is support for TIF rasters in the future, it is of course good to make sure that the behaviour will be similar
The administrator has disabled public write access.
The following user(s) said Thank You: a.barton

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40860

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
You're welcome ;)

Let's see if I understand properly :whistle: I believe there are 2 cases and what you're suggesting is basically a way to override what the header in the ASC file is saying about the grid inside the ASC file...

When xllcorner and yllcorner are used in the ASC file:
  1. Leave them as is; because the definitions are correct. i.e. values are for nodes
  2. Allow user to shift them by cellsize/2 to convert the grid to be centered on the values. i.e. the ASC file header is incorrect and needs to be changed

When xllcenter and yllcenter are used in the ASC file:
  1. Leave them as is; because the definitions are correct. i.e. values are for cells (pixels)
  2. Allow user to shift them by cellsize/2 to convert the grid to NOT be centered on the values. i.e. the ASC file header is incorrect and needs to be changed

Kindly,
Alan

PS GeoTIFF rasters are imported as 2D Rect Cells so they will always be "right". Whereas the ASC grid is entirely defined by the header values xllcorner/xllcenter in order to define whether the values are supposed to be in the center of the cells (or not).

PPS There are now 5 new Map File(s)... options that allow you to map *.tif files onto meshes (not grids). If needed, I could add some options to map *.tif files onto grids.
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40861

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
hhmmm... I take my first "PS" back... a GeoTIFF is not a 2D Rect Cell... :(

I'll have to look at that code in more depth too...
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40889

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 582
  • Thank you received: 105
Sorry for late reply.

Yes, I think it is correct. However, I assume that ASC files generated by GIS packages assign the elevation value to the cell center by default (there might be an option to assign the value to a cell corner but I am not aware of that).

So, for the vast majority of the cases, the ASC will be generated with cell-centered values. So the option 2 for the suggestion "When xllcorner and yllcorner are used in the ASC file" above is what is currently missing in BK to allow for a correct datum reference and subsequent interpolation/mapping.

Kind regards
PL
The administrator has disabled public write access.

Map Objects with ascii grid: interpolation method? 1 year 8 months ago #40894

  • a.barton
  • a.barton's Avatar
  • OFFLINE
  • Moderator
  • Posts: 529
  • Thank you received: 139
I think it would help me understand why GIS packages are not writing their ASC grids using xllcenter if I could read their documentation. Or, if you have such documentation, can you post a short quote about this?

Thanks!

Kindly,
Alan
The administrator has disabled public write access.
Moderators: Serrer, a.barton

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.