[mapserver-users] Bitmask created from vector layer
thomas bonfort
thomas.bonfort at gmail.com
Thu Aug 2 11:03:02 PDT 2018
those artifacts are most likely due to jpeg compression. you can force the
output to be aliased and contain only your requested colors by hand
crafting a special palette; search the docs for "formatoption + palette"
Thomas
Le mer. 1 août 2018 à 16:32, Luke Wendling <luke at slingshotaerospace.com> a
écrit :
> 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
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20180802/5df4214d/attachment.htm>
-------------- 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/20180802/5df4214d/attachment.png>
More information about the MapServer-users
mailing list