[mapserver-users] Bitmask created from vector layer

Luke Wendling luke at slingshotaerospace.com
Wed Aug 1 09:31:48 PDT 2018


Mapserver version 7.1

Hi, To create a bitmask image (for computer vision model training), I'm
creating a mapserver vector layer with TYPE POLYGON and setting the map
IMAGECOLOR as 0 0 0. The Layer config is
CLASS
  STYLE
     COLOR 255 255 255
     ANTIALIAS false

However the resulting raster image has gray spots as shown below:

[image: image.png]

I'm less concerned about the outer edge (maybe antialiasing?) and more
interested in the inner gray areas. Can anyone help explain what's
happening or give pointers on how to create a proper bitmask (all black or
white)?

Full mapfile is below


MAP
NAME valid
STATUS ON
PROJECTION
"init=epsg:4326"
END

IMAGECOLOR 0 0 0

# Register the image/tiff format so we can return 4 band images.
OUTPUTFORMAT
NAME GEOTIFF
DRIVER "GDAL/GTiff"
MIMETYPE "image/tiff"
IMAGEMODE BYTE
EXTENSION "tif"
FORMATOPTION "ALPHA=UNSPECIFIED"
FORMATOPTION "TILED=YES"
{# FORMATOPTION "COMPRESS=JPEG" #}
END

CONFIG "AWS_ACCESS_KEY_ID" "{{ AWS_ACCESS_KEY_ID }}"
CONFIG "AWS_SECRET_ACCESS_KEY" "{{ AWS_SECRET_ACCESS_KEY }}"
CONFIG "DEFAULT_REGION" "{{ DEFAULT_REGION }}"

WEB
METADATA
"wms_title" "Slingshot WMS Server"
"wms_onlineresource" "{{ wms_onlineresource }}"
"wms_enable_request" "GetCapabilities GetMap GetFeatureInfo"
"wms_srs" "EPSG:4326 EPSG:3857"
END
END

{% for layer in layers %}
# =========== {{layer.title}} ===========
{% if layer.is_vector %}
LAYER
NAME "{{ layer.name }}"
STATUS ON
TYPE POLYGON
{{ layer_params(layer) }}
CONNECTIONTYPE POSTGIS
CONNECTION "host={{db.host}} port={{db.port}} dbname={{db.name}} user={{db.
user}} password={{db.password}}"
{% if 'sql' in layer.metadata.mapserver %}
DATA "geometry from ({{ layer.metadata.mapserver.sql }}) as geometry using
unique id"
{% else %}
DATA "geometry from (select v.geometry, v.id from images_vector v inner
join images_provider p on (v.source_id = p.id) where p.name = '{{ layer.
metadata.provider }}') as geometry using unique id"
{% endif %}
PROJECTION
"init=epsg:4326"
END
CLASS
STYLE
COLOR 255 255 255
ANTIALIAS false
END
END
END
{% endif %}
{% endfor %}

END
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20180801/e419ed95/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 7026 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20180801/e419ed95/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2018-07-25 14-37-43.png
Type: image/png
Size: 4660 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20180801/e419ed95/attachment-0003.png>


More information about the mapserver-users mailing list