Re: [mapserver-users] styling based on attribute for MapServer derived MVTiles
Thanks , will use this from now on. Cheers Karsten _ From: Lime, Steve D (MNIT) [mailto:steve.l...@state.mn.us] Sent: Saturday, February 09, 2019 15:55 To: karsten; mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] styling based on attribute for MapServer derived MVTiles You can specify a type in the gml metadata and that will impact how the conversion is done in the mvt encoding. Something like: gml_mapcolor7_type integer Otherwise things are treated as strings... -Steve _ From: karsten Sent: Tuesday, February 5, 2019 3:01:51 PM To: mapserver-users@lists.osgeo.org Cc: Lime, Steve D (MNIT) Subject: RE: [mapserver-users] styling based on attribute for MapServer derived MVTiles Great, Thanks Steve I added "gml_include_items" "mapcolor7" to the Metadata block and got it working. One quirk seems to be that when I am trying to the values as integer (from the mapcolor7 column) specifying the style as in 1.) below did not work. However it I treat them as characters instead, quoted them and used "type": "categorical" in the json file for the style as in 2.) below it is working. Cheers Karsten 1.) { "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"] ] } } } 2.) { "id": "country-fill", "type": "fill", "source": "compass", "source-layer": "allcountries", "paint": { "fill-color": { "property": "mapcolor7", "type": "categorical", "stops": [ ["1", "#fdaf6b"], ["2", "#fdc663"], ["3", "#fae364"], ["4", "#d3e46f"], ["5", "#aadb78"], ["6", "#a3cec5"], ["7", "#ceb5cf"] ] } } } _ From: Lime, Steve D (MNIT) [mailto:steve.l...@state.mn.us] Sent: Tuesday, February 05, 2019 21:15 To: karsten; mapserver-users@lists.osgeo.org Subject: RE: [mapserver-users] styling based on attribute for MapServer derived MVTiles I believe the default WxS behavior is to expose no attributes. You need to be explicit and I don't see the gml_include_items metadata property in the mapfile for the layer allcountries. You'd need something like: "gml_include_items""mapcolor7" Added to the allcountries layer. The mvt-demo does this for most layers. --Steve From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of karsten Sent: Monday, February 04, 2019 4:33 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] styling based on attribute for MapServer derived MVTiles 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 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com %2Fsdlime%2Fmvt-demo=02%7C01%7Csteve.lime%40state.mn.us%7C8cad89d7aa6f4 f29f40e08d68bad2b0d%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C63684997321 4573577=5L4SwL6sPn9%2BFDEQbvM1%2BKzCQ6KtXdc6OACIm4afEDc%3D=0> ). 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/ <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.source pole.ch%2F2018%2F09%2F06%2Fthe-tale-of-a-vector-tile-benchmark%2F=02%7C 01%7Csteve.lime%40state.mn.us%7C8cad89d7aa6f4f29f40e08d68bad2b0d%7Ceb14b0462 4c445198f26b89c2159828c%7C0%7C0%7C636849973214583591=x0OMGP7hH2SvVQysW ctAAAlzU5kML4sxg1m9ZHj3yNM%3D=0> ) . 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.
Re: [mapserver-users] styling based on attribute for MapServer derived MVTiles
You can specify a type in the gml metadata and that will impact how the conversion is done in the mvt encoding. Something like: gml_mapcolor7_type integer Otherwise things are treated as strings... —Steve From: karsten Sent: Tuesday, February 5, 2019 3:01:51 PM To: mapserver-users@lists.osgeo.org Cc: Lime, Steve D (MNIT) Subject: RE: [mapserver-users] styling based on attribute for MapServer derived MVTiles Great, Thanks Steve I added "gml_include_items" "mapcolor7" to the Metadata block and got it working. One quirk seems to be that when I am trying to the values as integer (from the mapcolor7 column) specifying the style as in 1.) below did not work. However it I treat them as characters instead, quoted them and used "type": "categorical" in the json file for the style as in 2.) below it is working. Cheers Karsten 1.) { "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"] ] } } } 2.) { "id": "country-fill", "type": "fill", "source": "compass", "source-layer": "allcountries", "paint": { "fill-color": { "property": "mapcolor7", "type": "categorical", "stops": [ ["1", "#fdaf6b"], ["2", "#fdc663"], ["3", "#fae364"], ["4", "#d3e46f"], ["5", "#aadb78"], ["6", "#a3cec5"], ["7", "#ceb5cf"] ] } } } From: Lime, Steve D (MNIT) [mailto:steve.l...@state.mn.us] Sent: Tuesday, February 05, 2019 21:15 To: karsten; mapserver-users@lists.osgeo.org Subject: RE: [mapserver-users] styling based on attribute for MapServer derived MVTiles I believe the default WxS behavior is to expose no attributes. You need to be explicit and I don’t see the gml_include_items metadata property in the mapfile for the layer allcountries. You’d need something like: “gml_include_items”“mapcolor7” Added to the allcountries layer. The mvt-demo does this for most layers… --Steve From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of karsten Sent: Monday, February 04, 2019 4:33 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] styling based on attribute for MapServer derived MVTiles 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<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsdlime%2Fmvt-demo=02%7C01%7Csteve.lime%40state.mn.us%7C8cad89d7aa6f4f29f40e08d68bad2b0d%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C636849973214573577=5L4SwL6sPn9%2BFDEQbvM1%2BKzCQ6KtXdc6OACIm4afEDc%3D=0> ). 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/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.sourcepole.ch%2F2018%2F09%2F06%2Fthe-tale-of-a-vector-tile-benchmark%2F=02%7C01%7Csteve.lime%40state.mn.us%7C8cad89d7aa6f4f29f40e08d68bad2b0d%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C636849973214583591=x0OMGP7hH2SvVQysWctAAAlzU5kML4sxg1m9ZHj3yNM%3D=0> ) . 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
Re: [mapserver-users] styling based on attribute for MapServer derived MVTiles
Great, Thanks Steve I added "gml_include_items" "mapcolor7" to the Metadata block and got it working. One quirk seems to be that when I am trying to the values as integer (from the mapcolor7 column) specifying the style as in 1.) below did not work. However it I treat them as characters instead, quoted them and used "type": "categorical" in the json file for the style as in 2.) below it is working. Cheers Karsten 1.) { "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"] ] } } } 2.) { "id": "country-fill", "type": "fill", "source": "compass", "source-layer": "allcountries", "paint": { "fill-color": { "property": "mapcolor7", "type": "categorical", "stops": [ ["1", "#fdaf6b"], ["2", "#fdc663"], ["3", "#fae364"], ["4", "#d3e46f"], ["5", "#aadb78"], ["6", "#a3cec5"], ["7", "#ceb5cf"] ] } } } _ From: Lime, Steve D (MNIT) [mailto:steve.l...@state.mn.us] Sent: Tuesday, February 05, 2019 21:15 To: karsten; mapserver-users@lists.osgeo.org Subject: RE: [mapserver-users] styling based on attribute for MapServer derived MVTiles I believe the default WxS behavior is to expose no attributes. You need to be explicit and I don't see the gml_include_items metadata property in the mapfile for the layer allcountries. You'd need something like: "gml_include_items""mapcolor7" Added to the allcountries layer. The mvt-demo does this for most layers. --Steve From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of karsten Sent: Monday, February 04, 2019 4:33 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] styling based on attribute for MapServer derived MVTiles 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 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com %2Fsdlime%2Fmvt-demo=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f4584 46d1e2608d68af0c31b%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C63684916400 6408831=QYGGj%2FDN87pFfCjzP0CHZBoomTp38zRhupXy2%2BjGyi8%3D=0> ). 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/ <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.source pole.ch%2F2018%2F09%2F06%2Fthe-tale-of-a-vector-tile-benchmark%2F=02%7C 01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7Ceb14b0462 4c445198f26b89c2159828c%7C0%7C1%7C636849164006418845=F7kfmr8XBKaraOdKc glqApDt%2BSuWAHSJ7x%2BTI6GJCHw%3D=0> ) . 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 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com %2Fkarstenv%2Fmvt-benchmark%2Fblob%2Fmaster%2FMapServer%2Fcountries_mvt.png& data=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7 Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636849164006428858=1Xeo
Re: [mapserver-users] styling based on attribute for MapServer derived MVTiles
I believe the default WxS behavior is to expose no attributes. You need to be explicit and I don't see the gml_include_items metadata property in the mapfile for the layer allcountries. You'd need something like: "gml_include_items""mapcolor7" Added to the allcountries layer. The mvt-demo does this for most layers... --Steve From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of karsten Sent: Monday, February 04, 2019 4:33 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] styling based on attribute for MapServer derived MVTiles 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<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsdlime%2Fmvt-demo=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636849164006408831=QYGGj%2FDN87pFfCjzP0CHZBoomTp38zRhupXy2%2BjGyi8%3D=0> ). 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/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.sourcepole.ch%2F2018%2F09%2F06%2Fthe-tale-of-a-vector-tile-benchmark%2F=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636849164006418845=F7kfmr8XBKaraOdKcglqApDt%2BSuWAHSJ7x%2BTI6GJCHw%3D=0> ) . 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_mvt.png<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkarstenv%2Fmvt-benchmark%2Fblob%2Fmaster%2FMapServer%2Fcountries_mvt.png=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636849164006428858=1XeorZJ2Tf%2FeYSD2Cs5N3JcvszoU1nplrtrqDMc%2BqXw%3D=0> My complete style JSON is at https://github.com/karstenv/mvt-benchmark/blob/master/MapServer/ms_ne_simple.json<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkarstenv%2Fmvt-benchmark%2Fblob%2Fmaster%2FMapServer%2Fms_ne_simple.json=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636849164006438854=O4%2F91Tdg2%2BCCiHCJr1hvWqc9f4K%2B%2FBa%2FJAW4vBHbY58%3D=0> and the corresponding map file is here https://github.com/karstenv/mvt-benchmark/blob/master/MapServer/ne.map<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkarstenv%2Fmvt-benchmark%2Fblob%2Fmaster%2FMapServer%2Fne.map=02%7C01%7Csteve.lime%40state.mn.us%7C98620848f458446d1e2608d68af0c31b%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636849164006448867=CJawtbiFdYOcG2fa1PxgWHHfqV1Hz18tSz71k4N59ws%3D=0> 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 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] styling based on attribute for MapServer derived MVTiles
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 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users