<div dir="ltr">
<div>Good day Mapserver Users!</div><div><br></div><div>Not too long 
ago, we upgraded our development area to use Mapserver 7.6.4 which 
linkage to GDAL 3.4.0 and Proj 7.2.  Unfortunately, the contour images 
created via MS over areas which span the dateline are now wrapping back 
from one end to the other as shown in the first image at <a href="https://pasteboard.co/rHXaEwQEOT13.png">https://pasteboard.co/rHXaEwQEOT13.png</a>.</div><div></div><div><br></div><div>Our 
production area is using older versions (MS 7.2.2, GDAL 2.4, and Proj 
4.8) does not have this problem as indicated at <a href="https://pasteboard.co/aJL1HE6lIZ1u.png">https://pasteboard.co/aJL1HE6lIZ1u.png</a>.</div><div></div><div><br></div><div></div><div>This
 issue occurs with at least two of our datasets where the rasters which 
span the dateline and where we're using the MS CONNECTIONTYPE CONTOUR 
(and as I note later, this affects wind vector point creation too, 
CONNECTIONTYPE UVRASTER).  The longitudes in the images above span from 
120E to 1W.  In order for MS to produce this image (originally from GRIB
 files) and also put it the Mercator projection we wish to display it in
 (mostly because such rasters from our other datasets are in Mercator 
natively), we warp the grid from lat/lon using gdalwarp:</div><div><br></div><div>

<span style="color:rgb(34,34,34);font-family:monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">gdalwarp
 -q -s_srs '+proj=latlong +lon_wrap=180 +datum=WGS84 +no_defs 
+unit=degree +a=6371229 +b=6371229' -t_srs "+proj=merc +a=6378137 
+b=6378137 +lat_0=0.0 +lat_ts=0.0 +lon_0=180.0 +x_0=0.0 +y_0=0 +k=1.0 
+units=m" -ts 1912 0 -ot Int16 -overwrite -co COMPRESS=DEFLATE -co 
BLOCKXSIZE=128 -co BLOCKYSIZE=128 -co ZLEVEL=9 -co TILED=YES -co 
PREDICTOR=2<span> </span></span>

</div><div><br></div><div>As indicated, the -s_srs proj string is using 
the +lon_wrap=180 to indicate the longitudinal wrap and the -t_srs proj 
string is indicating lon_0 as 180, also indicating the need to produce a
 dateline crossing image.</div><div><br></div><div>In the MS epsg file, we created this projection for the contour image returned from MS:</div><div><br></div><div><920919>
 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=-180.0 +x_0=0.0 
+y_0=0 +k=1.0 +units=m +no_defs +over <></div><div><br></div><div>The map projection overall is <br></div><div><br></div><div><920916> +proj=merc +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +R=6378137 +k=1 +units=m +no_defs +over <></div><div><br></div><div>This is used for the data raster overlay in PNG format.</div><div><br></div><div>In the mapfile, these would appear as such (I included a bit more of the LAYER definition):</div><div><br></div><div>In the MAP section:</div><div><br></div><div>PROJECTION<br>       "init=epsg:920916"<br>  END</div><div><br></div><div>In the LAYER section:</div><div><br></div><div>LAYER<br>    NAME gcntr <br>    TYPE LINE<br>    STATUS DEFAULT<br>    <br>    CONNECTIONTYPE CONTOUR</div><div>....</div><div><br></div><div>    PROJECTION<br>   "init=epsg:920919"<br>    END<br>    <br>    PROCESSING "BANDS=1"<br>    PROCESSING "CONTOUR_ITEM=cvalue"<br>    PROCESSING "CONTOUR_INTERVAL=%intval%"<br>    PROCESSING "CONTOUR_LEVELS=%levels%"<br>    GEOMTRANSFORM (smoothsia(generalize([shape], 0.25*[data_cellsize])))<br>    LABELITEM "cvalue"</div><div>..... (EXPRESSION statements follow)<br></div><div><br></div><div> 
 The +lon_0=-180.0 for the contour layer projection properly positions 
the contours on top of the image overlay using the MAP's projection like
 so using Openlayers 4.6.5 on our production server as shown in <a href="https://pasteboard.co/DTSlmj4cBt0V.png">https://pasteboard.co/DTSlmj4cBt0V.png</a>.</div><div></div><div><br></div><div>Same 
mapfile with the same epsg file on our development platform with the 
updated MS, GDAL, and Proj yields the following display when rendered 
via Openlayers, <a href="https://pasteboard.co/YzryouudsshD.png">https://pasteboard.co/YzryouudsshD.png</a>.</div><div><br></div><div></div><div>The
 contours are not only wrapping but are cut off west of 180.  
Interestingly, the color dataset PNG image displays properly.  If we pan
 the map in our viewer where the center is east of the dateline, the 
horizontal wraparound line disappears.  Needless to say, we're very 
reluctant to update our production MS, GDAL and Proj with this issue 
present.  It also affects wind vector images as well BTW.</div><div><br></div><div>Just
 for more information, we're slicing out global-spanning GRIB datasets 
to the window I indicated, i.e. on a 0-360 dataset, it goes from 120 to 
359 (or 120E to 1W) and 80N to 30S (  we had run into problems initially
 going to the Prime Meridian).  We process the subset area in GDAL 
converting units and also saving to GeoTIFF as those have seemed to be 
easier working wrt geospatial considerations.  And finally, that GeoTiff
 is warped from the GRIB data's native projection to one we wish to 
display it in, in this case Mercator as a couple of other different 
dateline spanning datasets contain the data in that projection.</div><div><br></div><div>We
 have tried different combinations of not using the +lon_wrap as well as
 +lon_0=-180 and also +over.  However, we always end up with the contour
 lines wrapping around and the lines cut off to the west of the 
dateline.  We have also experimented with using different combinations 
of MS w/GDAL and Proj. old and new:</div><div><br></div><div>MS 7.2.2, GDAL 3.4, Proj 7.2 no contour wrap</div><div>MS 7.2.2, GDAL 3.4, Proj 4.8 no contour wrap</div><div>MS 7.6.4, GDAL 3.4, Proj 4.8 contour wrap</div><div><br></div><div>And of course the original configurations <br></div><div><br></div><div>MS 7.2.2, GDAL 2.2, Proj 4.8 no contour wrap (production server)<br></div><div>MS 7.6.4, GDAL 3.4, Proj 7.2 contour wrap (development server)<br></div><div><br></div><div>I
 searched release notes for wrapping fixes and only a few were listed in
 7.4.4 - #5975, 5965, 5960.   Perhaps one of these accidentally affected
 the MS CONTOUR and UVRASTER functions for dateline-spanning rasters?</div><div><br></div><div> I'll create a bug report if needed but thought I'd ask this group first.</div><div><br></div><div>Thanks for any help.</div><font color="#888888"><div><br></div><div>David Miller<br></div><div><br></div><div><br></div></font>

</div>