Slow inside check for POLYGON_CROP?

notsofast
notsofast Global Mapper User
I am exporting a relatively small number of raster tiles from a larger area using a POLYGON_CROP_FILE. It appears that it is taking almost as long to check whether a tile is inside the polygon as to actually output the tile. The crop polygon is admittedly complex because it follows specific tile boundaries, so maybe that is the root of the problem; but I wanted to check to make sure that there are no known issues with the tile-inside-polygon check.

As a workaround, is there a way I could specify a second, simpler polygon that would provide an early-out test?

This is my EXPORT_RASTER command:
EXPORT_RASTER \
    FILENAME="z:/layer_0/r0_tile.tif" \
    TYPE=GEOTIFF \
    SAMPLING_METHOD=AUTO \
    POLYGON_CROP_INT_DATA_BOUNDS=NO \
    POLYGON_CROP_GRID_ONLY=YES \
    GLOBAL_BOUNDS="277993.576,2665954.964,323817.576,2764207.764" \
    PIXEL_SIZE="916480x1965056" \
    QUALITY="100" \
    BG_TRANSPARENT=YES \
    COMPRESSION=NONE \
    GRID_TYPE_PIXEL_SIZE="1024,1024" \
    GRID_TYPE_ROWS_COLS="1919,895" \
    GRID_NAMING=SEPARATE \
    GRID_NAMING_COLS="NUM,1280,c,1" \
    GRID_NAMING_ROWS="NUM_REVERSE,0,r,1" \
    GRID_NAMING_PREPEND_ZEROES=YES \
    GRID_NAMING_SEPARATOR="-" \
    OVERWRITE_EXISTING=YES \
    GRID_CREATE_FOLDERS=YES \
    POLYGON_CROP_FILE="z:/r0_outline.shp" \
    POLYGON_CROP_USE_ALL=YES

Answers

  • bmg_bob
    bmg_bob Global Mapper Programmer
    Answer ✓
    There is an outstanding bug to improve performance when performing complex cropping of vector data, but none that specifically mentions raster data, although they could well be related.

    With respect to providing a second, simpler polygon, the inside polygon check first checks the full bounding rectangle of the polygon before performing the full test. We don't have a way to provide another polygon for this purpose.
  • notsofast
    notsofast Global Mapper User
    Yeah. I think I have an inconvenient case where the bounding rectangle may not be a good fit for the actual complex polygon.

    For your in/out test, I'm wondering if it would be faster to make a binary image with one pixel per output tile, render the polygon into the image, then just use the corresponding pixel as a flag for whether to render a tile. You might need to be careful along the edges... . Or a quadtree if you thought the image might get too big sometimes?