From fc5ec398ca2e9b1425dec7493baca02d43269007 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Wed, 22 Nov 2023 16:56:55 +0100 Subject: [PATCH] Add i18n information --- examples/PSILARTEMP.map | 611 ++++++++++++++++++++-------------------- grid_models.md | 91 ++++++ 2 files changed, 403 insertions(+), 299 deletions(-) diff --git a/examples/PSILARTEMP.map b/examples/PSILARTEMP.map index 732cd60..8c65434 100644 --- a/examples/PSILARTEMP.map +++ b/examples/PSILARTEMP.map @@ -1,319 +1,332 @@ MAP - # This mapfile is generated using Jinja2 templates - # - # Copyright (C) 2023 NIBIO <https://www.nibio.no/> - # This program is free software: you can redistribute it and/or modify - # it under the terms of the GNU Affero General Public License as published by - # the Free Software Foundation, either version 3 of the License, or - # (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU Affero General Public License for more details. - # - # You should have received a copy of the GNU Affero General Public License - # along with this program. If not, see <https://www.gnu.org/licenses/>. - - NAME "VIPS.PSILARTEMP" - - # WGS84 - EXTENT -1.5831861262936526 52.4465003983706595 39.2608060398730458 71.7683216082912736 - UNITS DD - - CONFIG "MS_ERRORFILE" "/disks/data01/mapserver/log/PSILARTEMP.log" - - PROJECTION - "init=epsg:4326" - END - - - WEB - IMAGEPATH "/disks/data01/mapserver/tmp/" - IMAGEURL "/tmp/" - # List of standard metadata: https://mapserver.org/ogc/wms_server.html#web-object-metadata - # i18n support: https://mapserver.org/ogc/inspire.html#inspire-multi-language-support - METADATA - "wms_keywordlist" "VIPS model Carrot Rust Fly (PSILARTEMP)" - "wms_abstract" " - <p>The warning system model «Carrot rust fly temperature» is based on a Finnish temperature-based model (Markkula <em>et al</em>, 1998; Tiilikkala & Ojanen, 1999; Markkula <em>et al</em>, 2000). The model determines the start of the flight period for the 1st and 2nd generation of carrot rust fly based on accumuleted degree-days (day-degrees) over a base temperature of 5,0 °C. VIPS uses the model for the 1st generation only.</p> - <p>Standard air temperature (temperature measured 2 m above ground) is used in the model. Degree-days are defined for this model as the sum of the difference between a base temperature of 5,0 °C and the mean temperature for all days with a temperature >5,0 °C, in other words (daily mean temperature – 5,0 °C) from 1 March (beginning when the ground has thawed).</p> - <h3>Interpretation of the warning</h3> - <p>Green rectangles indicate that the flight period has not yet begun. The accumulated day-degrees are < 260 degree-days (day-degrees).</p> - <p>Yellow rectangles indicate that the flight period is beginning and that flies can be coming into the field. The accumulated day-degrees are ≥ 260 degree-days (day-degrees).</p> - <p>Red rectangles indicate peak flight period. The accumulated day-degrees are ≥ 360 degree-days (day-degrees).</p> - <p>Grey rectangles indicate that the flight period of the 1st generation is over. The accumulated day-degrees are ≥ 560 degree-days (day-degrees).</p> - <p>Be aware that in areas with field covers (plastic, single or double non-woven covers, etc.) with early crops the preceding season (either on the current field or neighboring fields), the flight period can start earlier due to higher soil temperature under the covers.</p> - <p>The graphic presentation shows the progress of the day-degree calculation that is the basis for the green, yellow and red warnings (the line: «Accumulated day-degrees with the base temperature of 5 degrees C»). The graph show straight horizontal lines for the threshold values. «Day-degree threshold for low likelihood of attack» corresponds to when the warning changes from green to yellow (260 day-degrees). «Day-degree threshold for high likelihood of attack » corresponds to when the warning changes from yellow to red (360 day-degrees). «Day-degree threshold for end of flight period» corresponds to when the warning changes from red to grey (560 day-degrees) and the flight period for the 1st generation is considered to be over. When the line « Accumulated day-degrees with the base temperature of 5 degrees C» intersects one of the lines for the day-degree threshold, the warning will advance to the next level and the color of the warning rectangle will change. The graph also shows the daily mean temperature for the relevant weather station. The graph is dynamic and the user can choose which parameters that are shown by clicking on the explanation below the graph.</p> - <h3>Warning season – start and end of the warning</h3> - <p>Starting time: Shown in VIPS from 1 April (starting date for accumulation of degree-days beginning from when the ground has thawed).<br /> Ending time: When the model has reached the requirement for the end of the flight period for the 1st generation (560 day-degrees).</p> - <h3>Testing and validation of the model</h3> - <h4>National</h4> - <p>The model has been tested for Norwegian conditions in the period of 2011-2015. Validation has shown that the model was accurate for most locations for the 1st generation. The model was, however, inaccurate for the 2nd generation for many locations and was totally incorrect for the district of Jæren. Based on the validation results, we have therefore chosen to remove warning of the 2nd generation of carrot rust fly from this model.</p> - <h4>International</h4> - <p>The model is in use in Finland. The extent to which the model has been validated in Finland is uncertain, but a validation was done in the summer of 1997. This validation showed that the model was quite accurate, but that the threshold temperature sm should be lowered to 255 day-degrees for the start of the flight period (as opposed to 260 degree-days in the original model) and 355 degree-days forthe peak flight period (as opposed to 360 degree-days in the original model) (Tiilikkala & Ojanen, 1999).</p> - <h3>Literature</h3> - <p>Markkula, I., H. Ojanen and K. Tiilikkala. 1998. Forecasting and monitoring of the carrot fly (<em>Psila rosae</em>) in Finland. The 1998 Brighton Conference: Pests and Diseases: Conference Proceedings, Volume 2, pages 657-662.</p> - <p>Tiilikkala, K. and H. Ojanen. 1999. Use of a geographical information system (GIS) for forecasting the activities of carrot fly and cabbage root fly. IOBC/WPRS Bulletin 22 (5): 15-24.</p> - <p>Markkula, I., A. Hannukkala, A. Lehtinen, I. Mattila, H. Ojanen, S. Raisjio, P. Reijonen and K. Tiilikkala. 2000. Pest warnings and forecasts sent as SMS messages from models into \"farmer's pocket\". In publication: Pests & Diseases 2000. Proceedings of an international conference held at the Brighton Hilton Metropole Hotel, UK, 13-16 November 2000. BCPC Conference Proceedings pages 285-290.</p> - <p> </p> - <p><strong>Contacts</strong></p> - <p>Annette Folkedal Schjøll <a href=\"mailto:annette.folkedal.schjoll@nibio.no\">annette.folkedal.schjoll@nibio.no</a><br />Tor J. Johansen <a href=\"mailto:tor.johansen@nibio.no\">tor.johansen@nibio.no</a></p> - " - "wms_enable_request" "*" - "wms_title" "Carrot rust fly (Psila rosae) temperature model" - "wms_getfeatureinfo_formatlist" "text/plain,text/html,text/xml" - "wms_accessconstraints" "none" - "wms_addresstype" "" - "wms_address" "Høgskoleveien 7" - "wms_city" "Ås" - "wms_stateorprovince" "Ås" - "wms_postcode" "1430" - "wms_country" "Norway" - "wms_contactelectronicmailaddress" "vips@nibio.no" - "wms_feature_info_mime_type" "text/html" - "wms_contactperson" "Berit Nordskog" - "wms_contactposition" "owner" - "wms_contactorganization" "Norsk institutt for bioøkonomi (NIBIO)" - END - END #web - - ############################# Start of legend ######################################################### - # The legend configuration uses the CLASSITEM information in each layer to generate colour icons and labels - LEGEND - STATUS ON - KEYSIZE 16 12 - LABEL - TYPE TRUETYPE - SIZE 10 - COLOR 0 0 0 - OFFSET 0 -3 - END - END + # This mapfile is generated using Jinja2 templates + # + # Copyright (C) 2023 NIBIO <https://www.nibio.no/> + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU Affero General Public License as published by + # the Free Software Foundation, either version 3 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU Affero General Public License for more details. + # + # You should have received a copy of the GNU Affero General Public License + # along with this program. If not, see <https://www.gnu.org/licenses/>. + + NAME "VIPS.PSILARTEMP" + + # WGS84 + EXTENT -1.5831861262936526 52.4465003983706595 39.2608060398730458 71.7683216082912736 + UNITS DD + + CONFIG "MS_ERRORFILE" "/disks/data01/mapserver/log/PSILARTEMP.log" + + PROJECTION + "init=epsg:4326" + END + + + WEB + IMAGEPATH "/disks/data01/mapserver/tmp/" + IMAGEURL "/tmp/" + # List of standard metadata: https://mapserver.org/ogc/wms_server.html#web-object-metadata + # i18n support: https://mapserver.org/ogc/inspire.html#inspire-multi-language-support + METADATA + "wms_keywordlist" "VIPS model Carrot Rust Fly (PSILARTEMP)" + + "wms_inspire_capabilities" "embed" + "wms_languages" "en,nb" # The first is the default + + + "wms_abstract.nb" " + <h2>Modellbeskrivelse</h2> + <p>Varslingsmodellen «Gulrotflue svermetidspunkt» er basert på en finsk, temperaturbasert modell (Markkula <em>et al</em>, 1998; Tiilikkala & Ojanen, 1999; Markkula <em>et al</em>, 2000). Modellen beregner tidspunkt for sverming av 1. generasjon og 2. generasjon av gulrotflue basert på akkumulering av graddager (døgngrader) over en basistemperatur på 5 °C. I VIPS benyttes modellen kun for 1. generasjon.</p> + <p>Det er standard lufttemperatur (temperatur målt 2 m over bakken) som benyttes i modellen. Graddager er her definert som summen av differansen mellom en basistemperatur på 5 °C og døgnmiddeltemperatur for alle døgn med temperatur >5 °C dvs. summen av (døgnmiddeltemperatur - 5 °C) fra 1. mars (fra det er telefritt i jorda).</p> + <h2>Tolking av varsel</h2> + <p>Grønne bokser betyr at svermingen enda ikke har begynt. Akkumulering av døgngrader er < 260 graddager (døgngrader).</p> + <p>Gule bokser betyr svermingen er i startfasen og at man må være obs på at det kan komme innflyvere i åkeren. Akkumulering av døgngrader er ≥ 260 graddager (døgngrader).</p> + <p>Røde bokser betyr svermingen er på sitt mest aktive. Akkumulering av døgngrader er ≥ 360 graddager (døgngrader).</p> + <p>Grå bokser betyr at svermingen av 1. generasjon er over og varslingen er avsluttet. Akkumulering av døgngrader er ≥ 560 graddager (døgngrader).</p> + <p>Vær klar over at i områder med dekke (plast, enkel og dobbel fiberduk el. lign.) ved tidligproduksjon (enten på samme jorde eller nabojorder) året før, kan svermingen starte tidligere på grunn av høyere jordtemperatur under dekket.</p> + <h2>Varslingssesong – oppstart og avslutning av varsel</h2> + <p>Starttidspunkt: Vises i VIPS fra 1. april (startdato for akkumulering av graddager fra det er telefritt) i jorda.</p> + <p>Sluttidspunkt: Når modellen har nådd kravet til døgngrader for avsluttet sverming av 1. generasjon (560 døgngrader).</p> + <h2>Utprøving og validering av modellen</h2> + <h3>Nasjonalt</h3> + <p>Modellen har vært testet og evaluert for norske forhold i perioden 2011-2015. Valideringen har vist at modellen stemte ganske bra for de fleste steder for 1. generasjon. Modellen stemte imidlertid dårlig for 2. generasjon for mange lokaliteter og var direkte feil for Jæren-distriktet. På bakgrunn av resultatene fra valideringen har vi derfor valgt å fjerne varsling av 2. generasjon gulrotflue med denne modellen.</p> + <h3>Internasjonalt</h3> + <p>Modellen er i bruk i Finland. Det er usikkert hvor omfattende modellen er validert i Finland, men det er utført en validering sommeren 1997. Denne valideringen tilsa at modellen stemte nokså bra, men at terskeltemperatursummen burde reduseres til 255 graddager for svermingsstart (mot 260 graddager i den opprinnelige modellen) og 355 graddager for svermetoppen (mot 360 daggrader i den opprinnelige modellen) (Tiilikkala & Ojanen, 1999).</p> + <h2>Referanser</h2> + <ul> + <li>Markkula, I., H. Ojanen and K. Tiilikkala. 1998. Forecasting and monitoring of the carrot fly (Psila rosae) in Finland. The 1998 Brighton Conference: Pests and Diseases: Conference Proceedings, Volume 2, pages 657-662.</li> + <li>Tiilikkala, K. and H. Ojanen. 1999. Use of a geographical information system (GIS) for forecasting the activities of carrot fly and cabbage root fly. IOBC/WPRS Bulletin 22 (5): 15-24.</li> + <li>Markkula, I., A. Hannukkala, A. Lehtinen, I. Mattila, H. Ojanen, S. Raisjio, P. Reijonen and K. Tiilikkala. 2000. Pest warnings and forecasts sent as SMS messages from models into "farmer's pocket". In publication: Pests & Diseases 2000. Proceedings of an international conference held at the Brighton Hilton Metropole Hotel, UK, 13-16 November 2000. BCPC Conference Proceedings pages 285-290.</li> + " + "wms_abstract.en" " + <p>The warning system model «Carrot rust fly temperature» is based on a Finnish temperature-based model (Markkula <em>et al</em>, 1998; Tiilikkala & Ojanen, 1999; Markkula <em>et al</em>, 2000). The model determines the start of the flight period for the 1st and 2nd generation of carrot rust fly based on accumuleted degree-days (day-degrees) over a base temperature of 5,0 °C. VIPS uses the model for the 1st generation only.</p> + <p>Standard air temperature (temperature measured 2 m above ground) is used in the model. Degree-days are defined for this model as the sum of the difference between a base temperature of 5,0 °C and the mean temperature for all days with a temperature >5,0 °C, in other words (daily mean temperature – 5,0 °C) from 1 March (beginning when the ground has thawed).</p> + <h3>Interpretation of the warning</h3> + <p>Green rectangles indicate that the flight period has not yet begun. The accumulated day-degrees are < 260 degree-days (day-degrees).</p> + <p>Yellow rectangles indicate that the flight period is beginning and that flies can be coming into the field. The accumulated day-degrees are ≥ 260 degree-days (day-degrees).</p> + <p>Red rectangles indicate peak flight period. The accumulated day-degrees are ≥ 360 degree-days (day-degrees).</p> + <p>Grey rectangles indicate that the flight period of the 1st generation is over. The accumulated day-degrees are ≥ 560 degree-days (day-degrees).</p> + <p>Be aware that in areas with field covers (plastic, single or double non-woven covers, etc.) with early crops the preceding season (either on the current field or neighboring fields), the flight period can start earlier due to higher soil temperature under the covers.</p> + <p>The graphic presentation shows the progress of the day-degree calculation that is the basis for the green, yellow and red warnings (the line: «Accumulated day-degrees with the base temperature of 5 degrees C»). The graph show straight horizontal lines for the threshold values. «Day-degree threshold for low likelihood of attack» corresponds to when the warning changes from green to yellow (260 day-degrees). «Day-degree threshold for high likelihood of attack » corresponds to when the warning changes from yellow to red (360 day-degrees). «Day-degree threshold for end of flight period» corresponds to when the warning changes from red to grey (560 day-degrees) and the flight period for the 1st generation is considered to be over. When the line « Accumulated day-degrees with the base temperature of 5 degrees C» intersects one of the lines for the day-degree threshold, the warning will advance to the next level and the color of the warning rectangle will change. The graph also shows the daily mean temperature for the relevant weather station. The graph is dynamic and the user can choose which parameters that are shown by clicking on the explanation below the graph.</p> + <h3>Warning season – start and end of the warning</h3> + <p>Starting time: Shown in VIPS from 1 April (starting date for accumulation of degree-days beginning from when the ground has thawed).<br /> Ending time: When the model has reached the requirement for the end of the flight period for the 1st generation (560 day-degrees).</p> + <h3>Testing and validation of the model</h3> + <h4>National</h4> + <p>The model has been tested for Norwegian conditions in the period of 2011-2015. Validation has shown that the model was accurate for most locations for the 1st generation. The model was, however, inaccurate for the 2nd generation for many locations and was totally incorrect for the district of Jæren. Based on the validation results, we have therefore chosen to remove warning of the 2nd generation of carrot rust fly from this model.</p> + <h4>International</h4> + <p>The model is in use in Finland. The extent to which the model has been validated in Finland is uncertain, but a validation was done in the summer of 1997. This validation showed that the model was quite accurate, but that the threshold temperature sm should be lowered to 255 day-degrees for the start of the flight period (as opposed to 260 degree-days in the original model) and 355 degree-days forthe peak flight period (as opposed to 360 degree-days in the original model) (Tiilikkala & Ojanen, 1999).</p> + <h3>Literature</h3> + <p>Markkula, I., H. Ojanen and K. Tiilikkala. 1998. Forecasting and monitoring of the carrot fly (<em>Psila rosae</em>) in Finland. The 1998 Brighton Conference: Pests and Diseases: Conference Proceedings, Volume 2, pages 657-662.</p> + <p>Tiilikkala, K. and H. Ojanen. 1999. Use of a geographical information system (GIS) for forecasting the activities of carrot fly and cabbage root fly. IOBC/WPRS Bulletin 22 (5): 15-24.</p> + <p>Markkula, I., A. Hannukkala, A. Lehtinen, I. Mattila, H. Ojanen, S. Raisjio, P. Reijonen and K. Tiilikkala. 2000. Pest warnings and forecasts sent as SMS messages from models into \"farmer's pocket\". In publication: Pests & Diseases 2000. Proceedings of an international conference held at the Brighton Hilton Metropole Hotel, UK, 13-16 November 2000. BCPC Conference Proceedings pages 285-290.</p> + <p> </p> + <p><strong>Contacts</strong></p> + <p>Annette Folkedal Schjøll <a href=\"mailto:annette.folkedal.schjoll@nibio.no\">annette.folkedal.schjoll@nibio.no</a><br />Tor J. Johansen <a href=\"mailto:tor.johansen@nibio.no\">tor.johansen@nibio.no</a></p> + " + "wms_enable_request" "*" + "wms_title.en" "Carrot rust fly (Psila rosae) temperature model" + "wms_title.nb" "Gulrotflue svermetidspunktmodell" + "wms_getfeatureinfo_formatlist" "text/plain,text/html,text/xml" + "wms_accessconstraints" "none" + "wms_addresstype" "" + "wms_address" "Høgskoleveien 7" + "wms_city" "Ås" + "wms_stateorprovince" "Ås" + "wms_postcode" "1430" + "wms_country" "Norway" + "wms_contactelectronicmailaddress" "vips@nibio.no" + "wms_feature_info_mime_type" "text/html" + "wms_contactperson" "Berit Nordskog" + "wms_contactposition" "owner" + "wms_contactorganization" "Norsk institutt for bioøkonomi (NIBIO)" + END + END #web + + ############################# Start of legend ######################################################### + # The legend configuration uses the CLASSITEM information in each layer to generate colour icons and labels + LEGEND + STATUS ON + KEYSIZE 16 12 + LABEL + TYPE TRUETYPE + SIZE 10 + COLOR 0 0 0 + OFFSET 0 -3 + END + END + + + LAYER + NAME "PSILARTEMP.WARNING_STATUS.2023-04-01" + DATA "/disks/data01/mapserver/data/PSILARTEMP/result_WARNING_STATUS_2023-04-01.tif" + TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS + TYPE RASTER + PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template) + PROCESSING "NODATA=-1" + + + STATUS ON + METADATA + "wms_title" "Carrot rust fly (Psila rosae) temperature model 2023-04-01" + + "wms_abstract.en" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #707070;\"> </span> No forecast</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #00B457;\"> </span> No risk</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #FFCC00;\"> </span> Possible risk</li> + <li><span style=\"background-color: #FF0000;\"> </span> High risk</li> + </ul> + " + + "wms_abstract.nb" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #707070;\"> </span> Varsel beregnes ikke</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #00B457;\"> </span> Ingen infeksjonsrisikok</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #FFCC00;\"> </span> Mulig fare for angrep</li> + <li><span style=\"background-color: #FF0000;\"> </span> Høy fare for angrep</li> + </ul> + " + + END + CLASSITEM "[pixel]" + # class using simple string comparison, equivalent to ([pixel] = 0) - LAYER - NAME "PSILARTEMP.WARNING_STATUS.2023-04-01" - DATA "/disks/data01/mapserver/data/PSILARTEMP/result_WARNING_STATUS_2023-04-01.tif" - TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS - TYPE RASTER - PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template) - PROCESSING "NODATA=-1" - - - STATUS ON - METADATA - "wms_title" "Carrot rust fly (Psila rosae) temperature model 2023-04-01" - END - CLASSITEM "[pixel]" - - # class using simple string comparison, equivalent to ([pixel] = 0) - - CLASS - NAME "Model not running" - EXPRESSION ([pixel] >= 0 AND [pixel] < 2) - STYLE - COLOR 112 112 112 - END + CLASS + NAME "Model not running" + EXPRESSION ([pixel] >= 0 AND [pixel] < 2) + STYLE + COLOR 112 112 112 END - CLASS - NAME "No infection risk" - EXPRESSION ([pixel] >= 2 AND [pixel] < 3) - STYLE - COLOR 0 180 87 - END + END + CLASS + NAME "No infection risk" + EXPRESSION ([pixel] >= 2 AND [pixel] < 3) + STYLE + COLOR 0 180 87 END - CLASS - NAME "Possible infection risk" - EXPRESSION ([pixel] >= 3 AND [pixel] < 4) - STYLE - COLOR 255 204 0 - END + END + CLASS + NAME "Possible infection risk" + EXPRESSION ([pixel] >= 3 AND [pixel] < 4) + STYLE + COLOR 255 204 0 END - CLASS - NAME "High infection risk" - EXPRESSION ([pixel] >= 4) - STYLE - COLOR 255 0 0 - END + END + CLASS + NAME "High infection risk" + EXPRESSION ([pixel] >= 4) + STYLE + COLOR 255 0 0 END - END # Layer - - LAYER - NAME "PSILARTEMP.DD.2023-04-01" - DATA "/disks/data01/mapserver/data/PSILARTEMP/result_2023-04-01.tif" - TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template_DD.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS - TYPE RASTER - #PROCESSING "BANDS=1" # DD band on top (others invisible, but band values are available in the query template) - #PROCESSING "SCALE=AUTO" - #PROCESSING "NODATA=-1" - - - STATUS ON - METADATA - "wms_title" "Carrot rust fly (Psila rosae) temperature model Day Degrees 2023-04-01" - END - CLASSITEM "[pixel]" - CLASS - NAME "Day degrees" - #EXPRESSION ([pixel] >= 0 AND [pixel] <= 72) - STYLE - DATARANGE 0 1000 - COLORRANGE 0 0 255 255 0 0 - END - END - - END # Layer + END + END # Layer - - LAYER - NAME "PSILARTEMP.WARNING_STATUS.2023-04-02" - DATA "/disks/data01/mapserver/data/PSILARTEMP/result_WARNING_STATUS_2023-04-02.tif" - TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS - TYPE RASTER - PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template) - PROCESSING "NODATA=-1" - + LAYER + NAME "PSILARTEMP.DD.2023-04-01" + DATA "/disks/data01/mapserver/data/PSILARTEMP/result_2023-04-01.tif" + TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template_DD.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS + TYPE RASTER + STATUS ON + METADATA + "wms_title" "Carrot rust fly (Psila rosae) temperature model Day Degrees 2023-04-01" + + "wms_abstract.en" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"display: inline-block; width: 25px; background: linear-gradient(to right, #0000FF, #FF0000);\"> </span> Day degrees</li> + </ul> + " - STATUS ON - METADATA - "wms_title" "Carrot rust fly (Psila rosae) temperature model 2023-04-02" - END - CLASSITEM "[pixel]" - - # class using simple string comparison, equivalent to ([pixel] = 0) - - CLASS - NAME "Model not running" - EXPRESSION ([pixel] >= 0 AND [pixel] < 2) - STYLE - COLOR 112 112 112 - END - END - CLASS - NAME "No infection risk" - EXPRESSION ([pixel] >= 2 AND [pixel] < 3) - STYLE - COLOR 0 180 87 - END - END - CLASS - NAME "Possible infection risk" - EXPRESSION ([pixel] >= 3 AND [pixel] < 4) - STYLE - COLOR 255 204 0 - END - END - CLASS - NAME "High infection risk" - EXPRESSION ([pixel] >= 4) - STYLE - COLOR 255 0 0 - END + "wms_abstract.nb" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"display: inline-block; width: 25px; background: linear-gradient(to right, #0000FF, #FF0000);\"> </span> Døgngrader</li> + </ul> + " + + END + + CLASSITEM "[pixel]" + CLASS + NAME "Day degrees" + STYLE + DATARANGE 0 1000 + COLORRANGE 0 0 255 255 0 0 END - END # Layer + END + + END # Layer + + + LAYER + NAME "PSILARTEMP.WARNING_STATUS.2023-04-02" + DATA "/disks/data01/mapserver/data/PSILARTEMP/result_WARNING_STATUS_2023-04-02.tif" + TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS + TYPE RASTER + PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template) + PROCESSING "NODATA=-1" + - LAYER - NAME "PSILARTEMP.DD.2023-04-02" - DATA "/disks/data01/mapserver/data/PSILARTEMP/result_2023-04-02.tif" - TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template_DD.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS - TYPE RASTER - #PROCESSING "BANDS=1" # DD band on top (others invisible, but band values are available in the query template) - #PROCESSING "SCALE=AUTO" - #PROCESSING "NODATA=-1" - - - STATUS ON - METADATA - "wms_title" "Carrot rust fly (Psila rosae) temperature model Day Degrees 2023-04-02" - END + STATUS ON + METADATA + "wms_title" "Carrot rust fly (Psila rosae) temperature model 2023-04-02" + + "wms_abstract.en" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #707070;\"> </span> No forecast</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #00B457;\"> </span> No risk</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #FFCC00;\"> </span> Possible risk</li> + <li><span style=\"background-color: #FF0000;\"> </span> High risk</li> + </ul> + " + + "wms_abstract.nb" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #707070;\"> </span> Varsel beregnes ikke</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #00B457;\"> </span> Ingen infeksjonsrisikok</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #FFCC00;\"> </span> Mulig fare for angrep</li> + <li><span style=\"background-color: #FF0000;\"> </span> Høy fare for angrep</li> + </ul> + " + + END CLASSITEM "[pixel]" - CLASS - NAME "Day degrees" - #EXPRESSION ([pixel] >= 0 AND [pixel] <= 72) - STYLE - DATARANGE 0 1000 - COLORRANGE 0 0 255 255 0 0 - END - END - - END # Layer + # class using simple string comparison, equivalent to ([pixel] = 0) - LAYER - NAME "PSILARTEMP.WARNING_STATUS.2023-04-03" - DATA "/disks/data01/mapserver/data/PSILARTEMP/result_WARNING_STATUS_2023-04-03.tif" - TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS - TYPE RASTER - PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template) - PROCESSING "NODATA=-1" - - - STATUS ON - METADATA - "wms_title" "Carrot rust fly (Psila rosae) temperature model 2023-04-03" - END - CLASSITEM "[pixel]" - - # class using simple string comparison, equivalent to ([pixel] = 0) - - CLASS - NAME "Model not running" - EXPRESSION ([pixel] >= 0 AND [pixel] < 2) - STYLE - COLOR 112 112 112 - END + CLASS + NAME "Model not running" + EXPRESSION ([pixel] >= 0 AND [pixel] < 2) + STYLE + COLOR 112 112 112 END - CLASS - NAME "No infection risk" - EXPRESSION ([pixel] >= 2 AND [pixel] < 3) - STYLE - COLOR 0 180 87 - END + END + CLASS + NAME "No infection risk" + EXPRESSION ([pixel] >= 2 AND [pixel] < 3) + STYLE + COLOR 0 180 87 END - CLASS - NAME "Possible infection risk" - EXPRESSION ([pixel] >= 3 AND [pixel] < 4) - STYLE - COLOR 255 204 0 - END + END + CLASS + NAME "Possible infection risk" + EXPRESSION ([pixel] >= 3 AND [pixel] < 4) + STYLE + COLOR 255 204 0 END - CLASS - NAME "High infection risk" - EXPRESSION ([pixel] >= 4) - STYLE - COLOR 255 0 0 - END + END + CLASS + NAME "High infection risk" + EXPRESSION ([pixel] >= 4) + STYLE + COLOR 255 0 0 END - END # Layer - - LAYER - NAME "PSILARTEMP.DD.2023-04-03" - DATA "/disks/data01/mapserver/data/PSILARTEMP/result_2023-04-03.tif" - TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template_DD.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS - TYPE RASTER - #PROCESSING "BANDS=1" # DD band on top (others invisible, but band values are available in the query template) - #PROCESSING "SCALE=AUTO" - #PROCESSING "NODATA=-1" - - - STATUS ON - METADATA - "wms_title" "Carrot rust fly (Psila rosae) temperature model Day Degrees 2023-04-03" - END - CLASSITEM "[pixel]" - CLASS - NAME "Day degrees" - #EXPRESSION ([pixel] >= 0 AND [pixel] <= 72) - STYLE - DATARANGE 0 1000 - COLORRANGE 0 0 255 255 0 0 - END - END - - END # Layer + END + END # Layer + + LAYER + NAME "PSILARTEMP.DD.2023-04-02" + DATA "/disks/data01/mapserver/data/PSILARTEMP/result_2023-04-02.tif" + TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template_DD.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS + TYPE RASTER + STATUS ON + METADATA + "wms_title" "Carrot rust fly (Psila rosae) temperature model Day Degrees 2023-04-02" + + "wms_abstract.en" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"display: inline-block; width: 25px; background: linear-gradient(to right, #0000FF, #FF0000);\"> </span> Day degrees</li> + </ul> + " -END #map - - \ No newline at end of file + "wms_abstract.nb" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"display: inline-block; width: 25px; background: linear-gradient(to right, #0000FF, #FF0000);\"> </span> Døgngrader</li> + </ul> + " + + END + + CLASSITEM "[pixel]" + CLASS + NAME "Day degrees" + STYLE + DATARANGE 0 1000 + COLORRANGE 0 0 255 255 0 0 + END + END + + END # Layer + + + + + END #map + + \ No newline at end of file diff --git a/grid_models.md b/grid_models.md index 4d80c6c..cb154c4 100644 --- a/grid_models.md +++ b/grid_models.md @@ -123,6 +123,97 @@ LAYER ``` This will result in correct color presentation in the map, and the availability of a legend for the map (see the upper right corner in the screenshot above) +### Multi language support +Mapserver supports the &language=[language code] query parameter. Read more about the specifics [here](https://mapserver.org/ogc/inspire.html). Through this, we have been able to add language specific titles and abstracts. See an example below + +```mapserver +MAP +[...] + WEB + METADATA + [...] + "wms_inspire_capabilities" "embed" + "wms_title.en" "Carrot rust fly (Psila rosae) temperature model" + "wms_title.nb" "Gulrotflue svermetidspunktmodell" + END + END +END +``` + +#### Hacking i18n of mapserver generated legends +The auto generated legends from these mapserver sections do not support internationalization: + +```mapserver +CLASS + NAME "Model not running" + EXPRESSION ([pixel] >= 0 AND [pixel] < 2) + STYLE + COLOR 112 112 112 + END + END + CLASS + NAME "No infection risk" + EXPRESSION ([pixel] >= 2 AND [pixel] < 3) + STYLE + COLOR 0 180 87 + END + END + CLASS + NAME "Possible infection risk" + EXPRESSION ([pixel] >= 3 AND [pixel] < 4) + STYLE + COLOR 255 204 0 + END + END + CLASS + NAME "High infection risk" + EXPRESSION ([pixel] >= 4) + STYLE + COLOR 255 0 0 + END + END +``` +We have hacked this by using the `"wms_abstract"` metadata option for each layer. For example: + +```mapserver + LAYER + NAME "PSILARTEMP.WARNING_STATUS.2023-04-01" + [...] + METADATA + "wms_abstract.en" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #707070;\"> </span> No forecast</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #00B457;\"> </span> No risk</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #FFCC00;\"> </span> Possible risk</li> + <li><span style=\"background-color: #FF0000;\"> </span> High risk</li> + </ul> + " + + "wms_abstract.nb" " + <ul style=\"list-style: none; padding: 0;\"> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #707070;\"> </span> Varsel beregnes ikke</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #00B457;\"> </span> Ingen infeksjonsrisikok</li> + <li style=\"margin-bottom: 5px;\"><span style=\"background-color: #FFCC00;\"> </span> Mulig fare for angrep</li> + <li><span style=\"background-color: #FF0000;\"> </span> Høy fare for angrep</li> + </ul> + " + END + END +``` + +The client must then check if the layer abstract exists in the requested language. If not, default to the auto generated legend. For example like this (using OpenLayers): +```javascript +// See if there is a language specific legend available +if(currentLayer.Abstract != undefined) +{ + document.getElementById("layerLegend").innerHTML=currentLayer.Abstract; +} +else // Fallback to auto generated legend +{ + document.getElementById("layerLegend").innerHTML='<img id="layerLegendImg" src="' + currentLayer.Style[0].LegendURL[0].OnlineResource + '"/>'; +} +``` + ### Example Mapserver file For your reference, please see the file `examples/PSILARTEMP.map` in this repository. -- GitLab