[mapserver-users] styling based on attribute for MapServer derived MVTiles
karsten
karsten at terragis.net
Mon Feb 4 14:33:09 PST 2019
Dear All,
I was working on the configuration of MapServer generated MVT tiles for a
demo country world map and had success with MS v 7.2 outputting tiles in MVT
format ( all thanks to https://github.com/sdlime/mvt-demo ).
I am trying to work on the client side style for my demo map (using
mapbox-gl.js) and defined them in a similar way as JSON as in Steve's
mvt-demo above. The whole thing is later intended to be used in a benchmark
for MapServer MVT rendering speed versus T-Rex ( see
http://blog.sourcepole.ch/2018/09/06/the-tale-of-a-vector-tile-benchmark/ )
.
For now I am struggling with specifying the correct style syntax for the
client side and it seem that I missing something as I was not yet able to
successfully use attribute properties to render Countries as different
colors based on an attribute field of my PostGIS source.
Below is the configuration of my 'allcountries' layer. The mapcolor7 filed
is an integer field (in the input PostGIS source) but my set-up fails to
output multiple colors , instead I am getting all default black for the
country fill color. A second layer where I specified only Italy as one
Country 'country-italy' to show up renders fine - see
https://github.com/karstenv/mvt-benchmark/blob/master/MapServer/countries_mv
t.png
My complete style JSON is at
https://github.com/karstenv/mvt-benchmark/blob/master/MapServer/ms_ne_simple
.json
and the corresponding map file is here
https://github.com/karstenv/mvt-benchmark/blob/master/MapServer/ne.map
Would anyone know what I need to change in order to render the countries
with different colors according to the 'mapcolor7' attribute ?
To me it seems that somehow the attribute is not available to the renderer
even though in the MapServer map file I am selecting all fields in the
sub-query ...
Thanks
Karsten
--------------------------------------------
{
"id": "country-fill",
"type": "fill",
"source": "compass",
"source-layer": "allcountries",
"paint": {
"fill-color": {
"property": "mapcolor7",
"stops": [
[1, "#fdaf6b"],
[2, "#fdc663"],
[3, "#fae364"],
[4, "#d3e46f"],
[5, "#aadb78"],
[6, "#a3cec5"],
[7, "#ceb5cf"]
]
}
}
},{
"id": "country-italy",
"type": "fill",
"source": "compass",
"source-layer": "italy",
"paint": {
"fill-color": "#fdc663"
}
}
Karsten Vennemann
Terra GIS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20190204/fd24686d/attachment.htm>
More information about the MapServer-users
mailing list