Subscribe to this thread
Home - General / All posts - Anyway way to speed up Paste As Surface
djmcbell47 post(s)
#14-Sep-18 06:18

Hi all. I recently asked a question regarding waiting for an operation to complete, which I got to the bottom of.

Somewhat related, the process works - but takes ages. I'm using Manifold 8 and I've got a whole load of 50cm contours I need to paste as a surface. I'm using the below code:

UserInterface ui = (UserInterface)app.UserInterface;

  ui.Panes["Project"].ControlSet["TreeViewComponents"].Text = "Contours_50cm 2";

  ui.InvokeCommand("ViewProjectCopy""pane:Project");

  ui.InvokeCommand("ViewProjectPasteAsSurface""pane:Project");

  UserInterfaceDialog dlg = (UserInterfaceDialog)ui.ModalDialog;

 UserInterfaceControlSet controlset = (UserInterfaceControlSet)dlg.ControlSet;

  dlg.ControlSet["ComboBoxHeight"].Text = "Altitude";

 dlg.ControlSet["TextBoxPixelSizeX"].Text = "2";

 dlg.ControlSet["TextBoxPixelSizeY"].Text = "2";

 dlg.ControlSet["ComboBoxMethod"].Text = "Triangulation adjusted for contours";

 dlg.Accept();

Only issue is, it takes a load of time. Using the previous data (which I believe was 2m contours) it wouldn't take much time at all. A couple of minutes. Now, in some cases with the 50cm contour data, it can take half an hour (expected, since it is 16x the data) or sometimes hours or days - even on areas which aren't that much bigger than the half an hour lot.

A lot of the process is automated though I have attempted to cut back on the amount of data - for starters, it was grabbing data using min/max x and y extents in a rectangle, rather than fixing it to the shape we were looking at analysing (which previously meant a lot of extra data). I've fixed this using a ClipToIntersect to remove all the data apart from what we're interested in.

But is there any way anyone knows of to speed up a Paste As Surface, or anything I should look out for?

tjhb
10,094 post(s)
#14-Sep-18 06:38

First, test with reduced output resolution.

The complexity of the input vector data is not very important. The resolution and size of the output surface make all the difference.

If you get reasonable performance at resolution x, y, try increasing it somewhat, bearing in mind that execution time will scale roughly as the square of resolution.

If you are trying something unrealistic in Manifold 8, then either aim lower, or...

Switch to Manifold 9. It may be a false economy not to. It's inexpensive compared to your own time.

(P.s. it doesn't look as if you have actually corrected your code, in line with universal advice in the other thread.)

P.p.s. As a guide, if you are trying to create a surface more than about 10,000 x 10,000 pixels, then that is unrealistic in Manifold 8, and you would have to break your area of interest into more reasonable tiles (perhaps many), which must substantially overlap, to be cropped after creation.

djmcbell47 post(s)
#14-Sep-18 06:48

I did add some code (after what is here) which waits until the Paste As Surface dialog disappears before continuing.

But yes, when I've got a bit of time I must look into Manifold 9.

tjhb
10,094 post(s)
#14-Sep-18 06:49

Then why did you post code you are no longer using, saying that you are? Buh.

And as I said, *not* investing the time in switching to Manifold 9 for this task may be a false economy. It may take more time to continue in Manifold 8.

But that depends on output resolution, and whether you will need to subdivide data, and so on.

djmcbell47 post(s)
#14-Sep-18 06:57

I am still using this code, as well as a bit afterwards to handle the timing:

//+----------------------------------------------

  UserInterface ui = (UserInterface)app.UserInterface;

  ui.Panes["Project"].ControlSet["TreeViewComponents"].Text = "Contours_50cm 2";

  ui.InvokeCommand("ViewProjectCopy""pane:Project");

  ui.InvokeCommand("ViewProjectPasteAsSurface""pane:Project");

  UserInterfaceDialog dlg = (UserInterfaceDialog)ui.ModalDialog;

 UserInterfaceControlSet controlset = (UserInterfaceControlSet)dlg.ControlSet;

  dlg.ControlSet["ComboBoxHeight"].Text = "Altitude";

 dlg.ControlSet["TextBoxPixelSizeX"].Text = "2";

 dlg.ControlSet["TextBoxPixelSizeY"].Text = "2";

 dlg.ControlSet["ComboBoxMethod"].Text = "Triangulation adjusted for contours";

 dlg.Accept();

//+---------------------------------------------

 app.MessageBox("Please wait for the copy to catch up. The loader will resume shortly.",null);

 delay(25); //this was originally 5, changed to allow stuff to catch up

 int Proceed = 0;

 //if we can find it, loop, else exit loop

 while(Proceed==0)

 {

 if((string)ui.ModalDialog.Caption!="Paste As Surface"){Proceed=1;}

 }

 comps.Remove(theDrawing);

This task is on the back-burner for me at the moment in any case, and I'll look into Manifold 9 once I've got a few others off my plate, thanks.

tjhb
10,094 post(s)
#14-Sep-18 07:08

Then you didn't take the advice in the other thread. The code above is still incorrect.

If you want to proceed in 8, you really should take the advice that was offered, before you try anything else.

djmcbell47 post(s)
#20-Sep-18 06:02

Okay, I've installed Manifold Viewer. Basically, if I can prove it in Viewer, then there's the possibility for Manifold 9.

However, I can't find anything on surfaces. Anywhere. Even the help document doesn't seem to mention them. Does Viewer support them?

Unless I'm going about this the wrong way. I need to take contour lines and measure the area at specific angles. The code I inherited does this by pasting as a surface and then analysing from there.

djmcbell47 post(s)
#20-Sep-18 06:55

Never mind - found a different way around the issue.

Dimitri


7,413 post(s)
#20-Sep-18 07:04

Never mind - found a different way around the issue.

Once you raise a question in this forum and get people going to help you, it is part of the deal to explain the different way you found around the issue, so others who may have similar issues can learn from your experience. Please do that.

djmcbell47 post(s)
#20-Sep-18 07:14

Have decided not to interpolate when I paste the surface, but instead am interpolating once the surface has been pasted using a standard transform. Currently going through it now on a standard interpolate but, if that proves too slow, I can always use interpolate row. The missing sections aren't very big in the areas I need them.

adamw


10,447 post(s)
#24-Sep-18 14:19

This might work, but just in case it doesn't work as well as you want it to and you have to go back to interpolating contours into a surface, this is done using Interpolate, Triangulation with Segments transform for drawings in 9 / Viewer (in the linked page, search for 'interpolate', the page is quite big). Here is a walkthrough: Example: Vector to Raster using Kriging (you would use Triangulation with Segments, but the process is similar).

Dimitri


7,413 post(s)
#20-Sep-18 07:02

However, I can't find anything on surfaces. Anywhere. Even the help document doesn't seem to mention them. Does Viewer support them?

Of course.

Regarding "surfaces" those are simply rasters, which are called "images" in 9. Easy to see:

Step 1: Launch the User Manual

Step 2: Note how it opens to the Introduction topic, and that the very first four illustrations show dramatic renditions of what 8 calls "surfaces."

Step 3: There's this bit in the Getting Started topic, right up near the beginning of the topic: "

  • Images are also called raster data, or just rasters for short. Images in Manifold include all sorts of raster data, not just photographic images. Terrain elevation data as rasters, multi-channel data such as radar reflectivity or temperatures, and any other form of raster data are called images as well."

I don't mean the above sarcastically: don't make the mistake of thinking 9 is such a trivial thing that you already know everything you need to know, except for a bit of back-filling by searching for a key word or two. You have to read the user manual, at least the elementary topics in the Getting Started and Basics chapter, to get your head around 9.

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