maps with different projection ?

Smallpox vs. largepox, gen2 vs gen5, early war vs. peaceful alliances. Which is your favourite gaming style?
Molo_Parko
Hardened
Posts: 158
Joined: Fri Jul 02, 2021 4:00 pm

Re: maps with different projection ?

Post by Molo_Parko »

I noticed that the "Lowest land" label was missing The Dead Sea. That turned-out to be a problem in the resizing process of the FAO GLC Waterbodies Geodata TIFF image. If resized via a method which does not change the value of pixels in the final image, then The Dead Sea disappears because its two pixels were eliminated during resizing. If resized with a method that does change pixel values (the actual Geodata values) then The Dead Sea is included in the final image but the output is a fuzzy mess of pixel shades which wrecks other lakes because the Geodata values were altered.

So I again added to the process a second application of lakes and playas by saving a GProjector image of just the lakes and playas from NaturalEarth.com lakes dataset, and Playas dataset. Output 16384 pixel-width image then converted to bitmap, resized to 512x256 without creating new pixel values (other than black and white.). Used the resized bitmap image to plot lakes onto the current terrain layer map and voila! The Dead Sea is present, and Lake Baikal is fixed too, finally! Lake Nicaragua is still not present because it would be plotted next to ocean tiles, so it is skipped entirely since the choices are essentially not plotting it, or plotting it in the wrong place, or having lake tiles inexplicably contacting ocean.

Image
^ The Dead Sea is back.

Image
^ Terrain layer image with rivers overlayed.

Zipped scenario file attached.

EDIT: I reprojected the terrain and river layers as Adams World in a Square 1 map projection as an experiment. It's recognizable, but unsurprisingly, the re-projection in GProjector wrecked several things as it moved tiles around, and deleted at least 50% of the tiles since the reprojected map is 256x256 instead of 512x256. It may actually have removed more tiles from the habitable land areas, and replaced those with additional arctic tiles from the look of it. Rivers are broken all over the place. Some lakes became adjacent to ocean. The y lines of the map changed in North America and Russia to the extent that where desert becomes tundra is no longer a straight line across the map. Various new land connections formed between islands and continents. Great Lakes are disfigured, and so on.

Image
^ Adams World in a Square 1

This next re-projection faired better, no doubt because the number of pixels didn't decrease. I rotated the image for the Freeciv map. It's interesting. Some rivers broke (disconnected from the remaining part of the river.) Lake adjacent to ocean occurred in Indonesia. Sakhalin Island is once again connected to the Russian mainland. But overall much better than the Adams World in a Square 1 re-projection resulting in the map being half the original width.

Image
^ Solov'ev Perspective Cylindrical 500/50/180. Scenario file attached.
Attachments
Earth 256x512 Solovev Perspective Cylindrical 500_50_180.sav.zip
(44.28 KiB) Downloaded 229 times
Earth 255x198 Adams World in a Square 1 unrefined.sav.zip
(23.07 KiB) Downloaded 226 times
Earth 512x256.sav.zip
(38.57 KiB) Downloaded 234 times
Molo_Parko
Hardened
Posts: 158
Joined: Fri Jul 02, 2021 4:00 pm

Re: maps with different projection ?

Post by Molo_Parko »

Image
^ Another unusual re-projection: Earth Cassini 256x512=131k, 28% land, Classic, WrapX+Y (zipped scenario file attached, Freeciv 2.6.x format.)

The process of re-projecting the terrain and river layers caused the usual disconnections in rivers, new land-connection that shouldn't be, etc. For the Solv'ev projection, I converted the re-projected river layer to X,Y coordinates and replotted with an automated process (which fixes diagonal-only river connections.) For this Cassini re-projection, I instead converted the resulting river layer image bitmap directly to a new river layer as text without re-plotting by X,Y coordinates. After looking at both, I think that the re-plotting by X,Y method is better. The rivers in North America in the Cassini version are somewhat unrecognizable (which may be in-part due to the strange orientation of the map.)

I like the look of this Cassini version better than the Solov'ev re-projection. The Cassini seems less distorted, although it also seems a bit more disorienting when trying to move around on the map in Freeciv due to the orientation I selected (160, -90, 360 in GProjector.)

EDIT: I decided to run through the whole process again, but with slightly different initial conversion of the GEBCO Latest 2 color image. I created an alternate conversion script which handles color ranges somewhat differently. This time the converted topo/bathy image features more shallow oceans, fewer mountains, and more hills. I already had the GEBCO image saved as 512x256 reduced using Graphic Converter with Nearest Neighbor interpolation, and also a copy reduced using "No Interpolation". The alternate script reduced the total color combinations within the images, then converted to Freeciv tile types. The next step of the process merged the two converted images so that any pixel that is land in either image is land in the merged image. I also had the land merge script give preference to shallow ocean over deep ocean (if shallow ocean in one image and deep in the other image, it uses shallow.)

Image
^ GEBCO Latest 2 color image resized to 512x256 pixels using "Nearest Neighbor"

Image
^ GEBCO Latest 2 color image resized to 512x256 pixels using "No Interpolation".

Image
^ Pixel differences between the two different resize interpolation methods.

Image
^ The land-merged image with r,g, and b values reduced to a midrange value within each of 8 ranges. 256 possible values, divided by 8 ranges = 32 values per range. First range is 0-31 which is 32 values. So any r,g or b value within 0 to 31, would be changed to a midpoint value for the range, which is 16. This de-fuzzes the image by decreasing the total color combinations used. The original GEBCO Latest 2 color image has 1,378 color combinations. After constraining the ranges and reducing to 512x256, it's 48 which is much easier to convert to Freeciv's 14 terrain tile letters.

Image
^ The GEBCO elevation+ocean depths (topographical+bathymetric) only image after constraining the ranges to midpoint values, it is trivial to convert to Freeciv colors and/or tile letters.

Code: Select all

	elif [ ${b} -gt ${r} -a ${b} -gt ${g} ] ; then		# Blue dominant
		if [ ${g} -le 96 ] ; then
			r=000 g=033 b=129 chr=":" 				# deep ocean
		elif [ ${g} -ge 97 ] ; then
			r=0 g=46 b=137 chr=" " 				# shallow ocean
		fi
^ Example code for converting the constrained blue dominant RGB values which are -all- ocean in the GEBCO Latest 2 image color scheme. It's very easy to shift the line between deep and shallow ocean to get more of either.

Image
^ After running through the rest of the process steps, the new world image.

Next, I re-projected the image of the terrain layer, and also the river layer (as a bitmap), in GProjector using "Equirectangular Oblique" centered at 0 longitude, 70 north latitude, 180 height.

I converted the re-projected river layer bitmap to x,y coordinates for each pixel, then re-plotted the river layer using a script which fixes diagonal-only river connections. The Nile came out well, but some rivers are still broken/disconnected. It's still much better than resizing the river layer bitmap as an image.

Image
^ Re-projected river layer as bitmap from GProjector at 8192x4096.

Image
^ Resized bitmap to 512x256 is awful to the point of being unusable.

Converting black pixels from the 8192x4096 image to x,y coordinates, then re-plotting river tiles works much better. In this case, each x or y value was divided by 16 to plot on the smaller 512x256 map since the original 8192x4096 image was 16 times the size.

Image
^ Terrain layer image of the attached scenario (Earth Plate Caree Equirectangular Oblique) file using the new image with more shallow ocean and hills.
Attachments
Earth Plate Caree Equirectangular Oblique 512x256=131k, 28% land, Classic, WrapX+Y.sav.zip
(37.87 KiB) Downloaded 230 times
Earth Cassini 256x512=131k, 28% land, Classic, WrapX+Y.sav.zip
(42.48 KiB) Downloaded 240 times
Molo_Parko
Hardened
Posts: 158
Joined: Fri Jul 02, 2021 4:00 pm

Re: maps with different projection ?

Post by Molo_Parko »

I decided to try the "Polar Coordinates" feature of Photoshop. There appears to be no way to disable interpolation within that filter. So I tried the Gimp version, same problem. Gimp produced more altered RGB blends than Photoshop did - but both were extreme 7,000 to 8,000 new blends from the 13 Freeciv color original image. I was able to then replace invalid colors (for Freeciv) with valid Freeciv terrain colors (those used for map images saved from within Freeciv.) To do so required more than just RGB values about each pixel so I converted from RGB to HSL and then to HSV/B and was able to use the hue and saturation values to determine which wrong color to convert to which valid Freeciv color. My conversion is not perfect, all tiles in the final image are valid Freeciv colors, but some are not what they were originally - which didn't concern me too much at the time.

The source image was the new world image with more shallow oceans, as shown in the last post.

Image
^ After "Polar Coordinates" the 13 colors became thousands of colors due to interpolation which can't be disabled.

Image
^ Cropped, and after replacing the new blended colors with valid Freeciv image colors, it's back to 13 colors total with some tiles changed from what they had been originally.
Post Reply