Rasterization rules

SimonMSimonM Global Mapper UserPosts: 9
edited April 2012 in Raster Data
Hi, I'm looking at exporting a shape file to a raster format to create a mask. Initially I'm using V11, 1-bit geoTiff but will probably build a custom export plug-in and I'm open to upgrading. I have a couple of questions on the rasterization process.

1) What are the rules for coloring or not coloring a pixel? Is it 50% coverage or something more subtle?
2) I notice that the rasterization changes a lot when I turn borders on for the vector layer - more raster pixels are turned on, including some that don't touch the water.
water2.PNG

This image shows the original vector data plus 2 9 arc-second exports. The lighter color was with border = 1 pixel solid; the darker color was with no border.

Thanks for any help,
Simon

Comments

  • SimonMSimonM Global Mapper User Posts: 9
    edited April 2012
    BTW, the vector data looks blocky ... its the SRTM water body data, which just looks like that.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited April 2012
    If you are doing a rasterization of vector data, basically what happens is the polygon is rendered to an offscreen bitmap of the size specified for the export, so whether something is on or off depends on the polygon rendering algorithm used by Windows. It looks like you are rendering at very low resolution, so even a one pixel border will cover a very large area and make your mask go well outside (but not more than 1 full sample) beyond the water. What you might want to do instead is a 2-stage operation, one where you export a raster representation of the vector data at full resolution, then load that in and set the resampling method to an appropriate box averager, maximizer, or minimizer depending on how much you want to sub-sample it and how you want the output to behave in shifting to white or black for your 1-bit export based on the source pixels surrounding the sample location. For example a box minimizer will make the sub-sampled output pixel black if any samples within the box are black. A box maximizer will do the opposite and make the sample white in the output if any of the pixels sampled for that output pixel are white.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • SimonMSimonM Global Mapper User Posts: 9
    edited April 2012
    OK, thanks for the explanation. Sounds like a good plan. Does V13 support batch rasterization?
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited April 2012
    You can do it with a script. Just loop over your files in a script with DIR_LOOP_START and import each one, then export to a raster of the desired resolution, then maybe even load that result with the desired resampling and then export your final result. See http://www.globalmapper.com/helpv13/ScriptReference.html for more information.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
Sign In or Register to comment.