Skip to content

examples: the Europe map image lines up with the latitudes drawn on it - #1397

Open
adamgeorge309 wants to merge 2 commits into
masterfrom
topic/gy/europe-map-equirectangular
Open

adamgeorge309 wants to merge 2 commits into
masterfrom
topic/gy/europe-map-equirectangular

Conversation

@adamgeorge309

Copy link
Copy Markdown
Contributor

Figures that canvas visualizers draw on the Europe map of examples/mobility (SatelliteMobility configuration) were offset from the map image by up to 5.4 degrees of latitude with the example's old window, because the image is Web Mercator and GeoMapCanvasVisualizer maps latitude linearly. The markers of 11 capitals on the image fit a Web Mercator model with 0.24 pixel root mean square (RMS) error, and a model linear in latitude with 20 pixels. The change reprojects the image to equirectangular and declares the window that the reprojected image covers. After it, the figures are within 1 to 2 image pixels of the map. The labels drawn into the image are now distorted vertically, and a model that copied the old map window is misaligned by more until it declares the new one.

Closes #1396

The problem

EquirectangularProjection::geoToCanvas() (src/inet/common/geometry/common/EquirectangularProjection.cc:119) maps latitude linearly, and GeoMapCanvasVisualizer stretches mapImage over the same window. The fitted extent of images/maps/europe-er.png is 13.34 W to 44.13 E, 35.60 N to 67.62 N; the example declared 13.8 W to 44.3 E, 37 N to 73 N. A figure drawn at 60 N therefore landed on the image at 58.8 N, and at the top edge the offset reached 5.4 degrees.

The change

The image is resampled (bicubic) to equirectangular over 13.3 W to 44.1 E and 35.6 N to 67.6 N, at the same 1308 x 1245 pixel size, and the example declares that window. The new file has a 256-color palette instead of RGBA (red, green, blue, alpha) with 5230 colors, all opaque (340 kB instead of 524 kB). No other configuration uses europe-er.png.

Risks:

  • The labels drawn into the image (city and country names) are stretched vertically by up to about 1.4 times near 35.6 N and compressed to about 0.65 times near 67.6 N. Re-rendering the map from an equirectangular source would avoid this.
  • The image shipped in v4.7.0. A model that copied the old window (37 N to 73 N) and keeps it is misaligned by more after this change; the release note doc/whatsnew/fixes/examples-europe-map-equirectangular.txt gives the new window. The note is a fix and not an incompatible change, because the old window was already wrong for the old image, and the note gives the window to declare.
  • topic/gy/skyview-observer-titles and topic/gy/osm-map-coordinate-system also move the SatelliteMobility tyf row of tests/fingerprint/store.json from 332a-ea89, each for its own change. Whichever of the three merges later has to re-record that row again on the merged code, because the correct value depends on all of their changes.

Commits, in reading order:

  1. tests: change: re-record the SatelliteMobility tyf fingerprint for the new fake GUI probabilities (17a67ca219) prepares: it moves the SatelliteMobility tyf row from 772e-b194 to 332a-ea89 and changes nothing else. The cause is opp_repl 5049cc8fbe, which changed the fake graphical user interface (GUI) probabilities of the tyf ingredients from 0.1 to 0.001; INET does not change. Without it, the row fails on master under the current opp_repl, and the fix commit would carry two causes in one value. The same commit is the first commit of topic/gy/skyview-observer-titles and topic/gy/osm-map-coordinate-system, so it merges once.
  2. examples: fix: the Europe map image lines up with the latitudes drawn on it changes the drawn map and adds a release note. It moves the same row from 332a-ea89 to 3438-54ea (see Verification); no fingerprint that continuous integration (CI) checks moves.

Architectural surface

No contract, packet, NED parameter or feature changes. Configuration surface: the four *.europe.map window parameters of SatelliteMobility in examples/mobility/omnetpp.ini. Asset: images/maps/europe-er.png changes projection; its file name is the known exception NV-17.

Verification

Base: a40c4ffcdc (build: fix: the description of the INET package names the Testing chapter as text), the origin/master on 2026-10-28. Release build.

Qtenv, in examples/mobility, the europe module inspected at 200% zoom and exported with Qtenv's image export (the simulation's own Model Context Protocol (MCP) server, get_canvas_image with area module_rectangle):

inet -u Qtenv -c SatelliteMobility --mcp-server-address=localhost:8796

"Before" is the image of origin/master with its window (--*.europe.map.minLatitude=37.0deg --*.europe.map.maxLatitude=73.0deg --*.europe.map.minLongitude=-13.8deg --*.europe.map.maxLongitude=44.3deg); the branch changes no source file, so the same build serves both. Before the change, the 60 degree graticule line runs 62 image pixels (31 pixels at 100% zoom) south of the Helsinki marker (60.17 N). After it, the line runs 7 image pixels south of the marker, which is about the 0.17 degree that the city lies north of 60 N (6.6 pixels).

Helsinki and the 60°N line, before and after

The whole europe canvas, before and after:

Europe canvas before

Europe canvas after

GeoMapCanvasVisualizer creates no figures without a graphical user interface (GUI) (src/inet/visualizer/canvas/scene/GeoMapCanvasVisualizer.cc:48, if (!hasGUI()) return;), so only the tyf ingredient (y display strings, f canvas figures), which runs Cmdenv with a fake GUI, can see this change.

Fingerprints that CI checks: opp_run_fingerprint_tests -p inet -m release --no-build -w examples/mobility (opp_repl origin/main, 39e15bc) gives 32 PASS at each of the two commits: the tplx, ~tNl and ~tND rows of all 32 stored examples/mobility configurations. opp_run_fingerprint_tests -p inet -m release --no-build -w examples/mobility -c '^SatelliteMobility$' --ingredients tyf gives PASS at each of the two commits, against 332a-ea89 after commit 1 and 3438-54ea after commit 2.

The tyf row of SatelliteMobility is re-recorded with the current opp_repl arguments. opp_repl changed its tyf arguments in 5049cc8fbe (committed 2026-10-26): the fake GUI probabilities went from 0.1 to 0.001. Computed with both sets, on a checkout of the base and on the branch (-r 0 --sim-time-limit=3600s):

tyf arguments base branch
probabilities 0.1 (opp_repl before 5049cc8fbe) 772e-b194 (the old stored value) 3977-3f7d
probabilities 0.001 (opp_repl origin/main) 332a-ea89 3438-54ea (the new stored value)

Commit 1 records the step from 772e-b194 to 332a-ea89, which the opp_repl change alone causes, on the same INET code; commit 2 records the step from 332a-ea89 to 3438-54ea, which this change causes. With the new value, opp_run_fingerprint_tests -p inet -m release --no-build -w examples/mobility --ingredients tyf gives 29 PASS of 31 on the branch; AttachedMobility and SuperpositioningMobility fail on the base too, and this change does not reach them. The other 30 stored tyf rows of examples/mobility compute the same values on the base and on the branch under both sets of arguments.

Gates, on this description without its title and branch lines:

doc/project/enforcement/check-pull-request.sh --base origin/master --head HEAD --description-file <this description>

All six gates pass with 0 violations and 0 notes: check-commits.sh, check-classification.sh, check-includes.sh, check-ned-params.sh, check-whatsnew.sh and check-pr-description.sh.

Not verified: the alignment was measured at the capital markers and at Helsinki only.

…e new fake GUI probabilities

Before this commit, the tyf fingerprint test of the SatelliteMobility configuration of examples/mobility fails on an unchanged INET tree: the stored value is 772e-b194, and the test now calculates 332a-ea89. The stored value was recorded when opp_repl ran the tyf ingredients with fake graphical user interface (GUI) probabilities of 0.1. opp_repl commit 5049cc8fbe changed these probabilities (before event, after event, on hold and on simulation time) to 0.001.

After this commit, the row stores 332a-ea89, and the test passes again. No INET source, configuration or image changes. The y (display strings) and f (canvas figures) ingredients are added on each refreshDisplay() call that the fake GUI makes, and the probabilities decide when those calls happen, so the new arguments alone move the value. The simulation itself does not change: the other ingredient sets of this configuration keep their stored values.

Provenance: opp_run_fingerprint_tests of opp_repl main 39e15bc, -m release -w examples/mobility -c '^SatelliteMobility$' --ingredients tyf, release build of a40c4ff.

Change: tests | behavior.change | fingerprint
… on it

GeoMapCanvasVisualizer stretches its map image linearly in latitude and longitude, so the image must be equirectangular. images/maps/europe-er.png was a Web Mercator image, and examples/mobility declared it as 13.8 W to 44.3 E and 37 N to 73 N. Every figure drawn on the Europe map was offset from the image: about 1.2 degrees (130 km) at 60 degrees north, and 5.4 degrees at the top edge. To see it, open the europe module of the SatelliteMobility configuration in Qtenv and compare the 60 degree graticule line with Helsinki (60.17 N): at 100% zoom the city is about 30 pixels north of the line.

Fitted to the markers of 11 capitals, a Web Mercator model with square pixels leaves 0.24 pixel root mean square (RMS) error and a model linear in latitude 20 pixels. The fit puts the old image at 13.34 W to 44.13 E and 35.60 N to 67.62 N.

The image is now resampled (bicubic) to equirectangular over 13.3 W to 44.1 E and 35.6 N to 67.6 N, with the same 1308 x 1245 pixel size and a 256-color palette (340 kB instead of 524 kB), and the example declares that window. The capital markers are within 1 to 2 pixels of their linear positions; the labels drawn into the image are stretched vertically in the south and compressed in the north.

Only the tyf fingerprint (display strings and canvas figures) of SatelliteMobility moves, from 332a-ea89 to 3438-54ea, because the map window positions the canvas figures. The image shipped in v4.7.0 and the release note gives the new window.

Change: examples.mobility | behavior.change.fix | fingerprint whatsnew

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

examples: images/maps/europe-er.png is a Web Mercator image, GeoMapCanvasVisualizer draws it as equirectangular

1 participant