Cropping with holes, and masking data
tjhb
Global Mapper UserTrusted User
Currently we can use one or more areas to crop output data, both in the GUI and in the scripting environment.
We can specify whether to crop to a bounding box of all areas, or to the areas themselves, either all together or separately. Which is great.
There are two things which I think we can't do, which are closely related.
(1) If a cropping area has a hole in it, the hole is ignored, so that data falling "outside" the cropping area, but within its hole, is included in the export. Would it slow things down enormously to have holes excluded from the cropping area?
(2) It would be nice to be able to specify area(s) of data to exclude, or mask, as well as or instead or area(s) to include in the crop. In the GUI, this would probably have to implemented as an either-or option, since cropping is based on selection, which is a Boolean property. In the scripting environment, it might be possible to allow both (say) a POLYGON_MASK_FILE alongside the POLYGON_CROP_FILE option we have now. The two could work together (with the mask file taking precedence in case of overlap).
If (2) were implemented then then it would be possible to take care of (1) explicitly (at least for scripting) by replacing the hole areas with a separate masking file.
Best regards,
Tim
We can specify whether to crop to a bounding box of all areas, or to the areas themselves, either all together or separately. Which is great.
There are two things which I think we can't do, which are closely related.
(1) If a cropping area has a hole in it, the hole is ignored, so that data falling "outside" the cropping area, but within its hole, is included in the export. Would it slow things down enormously to have holes excluded from the cropping area?
(2) It would be nice to be able to specify area(s) of data to exclude, or mask, as well as or instead or area(s) to include in the crop. In the GUI, this would probably have to implemented as an either-or option, since cropping is based on selection, which is a Boolean property. In the scripting environment, it might be possible to allow both (say) a POLYGON_MASK_FILE alongside the POLYGON_CROP_FILE option we have now. The two could work together (with the mask file taking precedence in case of overlap).
If (2) were implemented then then it would be possible to take care of (1) explicitly (at least for scripting) by replacing the hole areas with a separate masking file.
Best regards,
Tim
Comments
-
Further to (1).
I haven't tested what currently happens with islands within holes, but I assume they count as part of the cropping area as well. If holes in cropping areas were excluded, then islands within holes (and holes within the islands, and so on) would need to be dealt with explcitly. Which might be slow. -
Are you exporting to vector or raster formats? I would expect holes in crop areas to already be used when exporting to a new raster format file, is this not what you are seeing?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Vector in the present case. I should have tested with raster data too. I will.
-
Ah yes, our library for cropping vector features to polygons currently doesn't have real direct support for cropping to polygons with holes in them, so the holes are ignored when cropping on export. Raster exports do support cropping with holes though as that just adds more point-in-polygon tests to the operation.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Not much interest in adding a POLYGON_MASK_FILE option to the scripting interface? I wonder whether others would find that useful too.
-
It would basically run into the same problem as cropping to areas with holes does since that's what the mask would basically be. I think it would be better to just support cropping to areas with holes in them rather than add another parameter to achieve the same thing.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Yes, that would be better, if the library is updated at some point.
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website