Subscribe to this thread
Home - General / All posts - Scripting Image Merge
512 post(s)
#12-Jan-23 17:28

I'm trying to get a fast workflow established for merging rasters.

In this example, we have 151 ASCII text grid files. I take a list of those file names, jam them into my Google Sheet

, and then run the calculated field contents in a Release 9 command window.

From this point, I have to open the map component in order to access the "Edit -> Merge -> Merge Images..." dialog. The map takes about 5 minutes to open. The info messages on each layer is just that intermediate levels are not updated, which I don't care about in this workflow.

I click merge and a new image component is instantly created, apparently of the correct dimensions but containing no data rows.

So first, am I doing something wrong?

Second, the magic that happens when the MERGE button is clicked would be wonderful to see in its SQL form, which would remove the need to interactively "open" (and await) the map component rendering on-screen, and facilitate a SQL-only interface for this workflow. Is that possible, to see the commands that are run for "Merge Images"?

Thank you,




10,447 post(s)
#13-Jan-23 12:17

Part of what happens in the Merge dialog for images does not currently have a corresponding SQL function -- basically because a direct mapping to SQL does not work. The code operates on an arbitrary number of components, the usual way to pass an arbitrary number of anything to an SQL function is via a table, but in this case each record of that table has to be a table as well = not possible directly. This can be solved, of course, and we will do this. But that's why we don't have it yet, because a direct mapping does not work and we need to invent something else.

On to the issue:

Is the coordinate system of each image exactly EPSG:26907 with the pixels being 1x1 m and varying offsets? If so, merging shouldn't indeed need intermediate layers. If the coordinate systems of some images are different, these images will be reprojected on the fly and that *does* need intermediate layers.

I tried to reproduce the issue but couldn't so far, guess I need to create the map programmatically like you do (because if I manually open a data source for a specific image, this gives that data source time to load / cache / etc, and maybe that's why everything works in my test after, unlike in your case).

Also, the images are XYZ files, correct? (From PROPERTY 'Type' 'xyz' in the screens.)

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.