function getUrl(baseUrl, params, extent, size) {
  const width = Math.round(size[0]);
  const height = Math.round(size[1]);
  const mapSize = `${width} ${height}`;
  const mapExt = `${extent[0]} ${extent[1]} ${extent[2]} ${extent[3]}`;

  const baseParams = {
    mode: 'map',
    map_imagetype: 'png',
    mapext: mapExt,
    imgext: mapExt,
    map_size: mapSize,
    imgx: width / 2,
    imgy: height / 2,
    imgxy: mapSize,
  };
  Object.assign(baseParams, params);
  return appendParams(baseUrl, baseParams);
}
@param {string} baseUrl The MapServer url.
@param {Object<string, string|number>} params Request parameters.
@param {import("../extent.js").Extent} extent Extent.
@param {import("../size.js").Size} size Size.
@return {string} The MapServer map image request URL.