Analysis Report: Location Tab Issues in Remote Control Plugin #5058
kutaibaa-akraa
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@gzotti @alex-w @10110111
Report ID: RC-LOC-420-001
Date: July 26, 2026
Author: kutaibaa-akraa
Related PR: #4956 - Comprehensive Remote Control Enhancement
1. Executive Summary
The Location tab in the Stellarium Remote Control plugin has two issues that affect usability:
This report documents the root cause of both issues and proposes a server-side fix that requires no client-side filtering workarounds.
2. Problem Description
2.1 Issue 1: Region Dropdown Not Filtered by Planet
Observed Behavior:
When a user changes the planet from Earth to Mars (or any other celestial body), the Region dropdown continues to display all regions for all planets (~250 entries).
Expected Behavior:
The Region dropdown should display only regions relevant to the currently selected planet (e.g., 16 Martian regions for Mars, ~24 Earth regions for Earth).
Current API Response for
GET /api/location/regionlist:[ {"name": "Northern Africa", "name_i18n": "Northern Africa"}, {"name": "Western Asia", "name_i18n": "Western Asia"}, {"name": "Aphrodite Terra", "name_i18n": "Aphrodite Terra"}, {"name": "Ishtar Terra", "name_i18n": "Ishtar Terra"}, {"name": "Ocean of Storms", "name_i18n": "Ocean of Storms"}, {"name": "Acidalia Planitia", "name_i18n": "Acidalia Planitia"}, ... ]All 250+ regions from all planets are returned as a single flat array with no planet identifier.
Desired API Response for
GET /api/location/regionlist?planet=Mars:[ {"name": "Acidalia Planitia", "name_i18n": "Acidalia Planitia"}, {"name": "Amazonis Planitia", "name_i18n": "Amazonis Planitia"}, {"name": "Arcadia Planitia", "name_i18n": "Arcadia Planitia"}, {"name": "Argyre Planitia", "name_i18n": "Argyre Planitia"}, {"name": "Chryse Planitia", "name_i18n": "Chryse Planitia"}, {"name": "Elysium Planitia", "name_i18n": "Elysium Planitia"}, {"name": "Hellas Planitia", "name_i18n": "Hellas Planitia"}, {"name": "Isidis Planitia", "name_i18n": "Isidis Planitia"}, {"name": "Utopia Planitia", "name_i18n": "Utopia Planitia"}, {"name": "Aonia Terra", "name_i18n": "Aonia Terra"}, {"name": "Arabia Terra", "name_i18n": "Arabia Terra"}, {"name": "Terra Cimmeria", "name_i18n": "Terra Cimmeria"}, {"name": "Terra Sabaea", "name_i18n": "Terra Sabaea"}, {"name": "Vastitas Borealis", "name_i18n": "Vastitas Borealis"}, {"name": "Tharsis", "name_i18n": "Tharsis"}, {"name": "Planum Boreum", "name_i18n": "Planum Boreum"} ]2.2 Issue 2: No "Return to Default Location" via StelAction
The regular Stellarium GUI (Location window) has a "Return to default location" button that calls
StelCore::returnToDefaultLocation(). However:StelCore::returnToDefaultLocation()is not exposed as a StelActionactionGo_Home_Globalworks via the StelAction API, but this is a general "go home" action that duplicates behavior with additional landscape managementLandscapeMgr.defaultLandscapeIDonly returns the landscape (e.g., "guereins") but not the location coordinates3. Root Cause Analysis
3.1 Region Filtering – The Server Already Has the Logic
The core filtering logic already exists in
StelLocationMgr::getRegionNames():stellarium/src/core/StelLocationMgr.cpp
Line 1476 in f24728c
The problem is in
LocationService.cpp– it callsgetRegionNames()with no argument (implicitly empty string) instead of the current planet:stellarium/plugins/RemoteControl/src/LocationService.cpp
Line 59 in f24728c
3.2 Why Client-Side Filtering Is Not the Solution
While we could filter regions in JavaScript based on naming patterns (e.g., "Planitia" = Mars, "Sea of" = Moon), this approach is:
4. Proposed Solution: Server-Side Fix
4.1 Modify
LocationService.cppFile: plugins/RemoteControl/src/LocationService.cpp
Proposed fix:
4.2 API Behavior After Fix
GET /api/location/regionlistGET /api/location/regionlist?planet=EarthGET /api/location/regionlist?planet=MarsGET /api/location/regionlist?planet=MoonGET /api/location/regionlist?planet=Venus4.3 Client-Side Changes (Minimal)
With the server fix, the client code becomes trivially simple – no filtering needed:
When the user changes the planet, we simply reload the region list with the new planet parameter.
4.4 The
getRegionNames()Function in StelLocationMgrThe function is declared in
StelLocationMgr.hppwith an optional parameter:stellarium/src/core/StelLocationMgr.hpp
Line 111 in f24728c
And implemented in
StelLocationMgr.cpp:stellarium/src/core/StelLocationMgr.cpp
Line 1476 in f24728c
4.5 The
GeoRegionStructureThe structure that holds region data includes the planet field:
stellarium/src/core/StelLocationMgr.hpp
Line 36 in f24728c
5. Return to Default Location
5.1 Current State
actionGo_Home_Global(StelAction)StelCore.returnToDefaultLocation()(StelAction)LandscapeMgr.defaultLandscapeID(StelProperty)5.2 Analysis from Source Code
In
StelCore.cpp,returnToDefaultLocation()exists:stellarium/src/core/StelCore.cpp
Line 1177 in f24728c
And in
StelCore.hpp, the function is declared as apublic slot:stellarium/src/core/StelCore.hpp
Line 479 in f24728c
The
returnToHome()function also exists:stellarium/src/core/StelCore.cpp
Line 1193 in f24728c
In
StelCore::init(),actionGo_Home_Globalis registered:stellarium/src/core/StelCore.cpp
Line 385 in f24728c
5.3 Recommendation
The existing
actionGo_Home_Globalis sufficient for the Remote Control interface. It provides the same functionality as the GUI's "Return to default location" button. No server-side changes are needed for this feature.Note:
returnToDefaultLocation()is not currently exposed via the StelAction API. If there is a need to expose it directly, it could be added toStelActionMgrin the same manner asactionGo_Home_Global.The button in the RC interface can call:
6. Impact and Benefits
6.1 Immediate Benefits
6.2 Backward Compatibility
planetparameter is optional7. Implementation Checklist
planetparameterplanettogetRegionNames()instead of empty stringapi/location.jsto sendplanetparameter (minimal change)8. Files to Modify
9. Conclusion
The Region dropdown issue has a simple, one-file server-side fix that leverages existing infrastructure (
getRegionNames()already supports planet filtering). No client-side workarounds are needed, and the fix is fully backward-compatible.This is a server-side only change that requires no new API endpoints, no breaking changes, and minimal code modification.
The "Return to Default Location" functionality is already available through the existing
actionGo_Home_GlobalStelAction.10. References
Related Code Files
getRegionNames()with planet filteringgetRegionNames()with optional parameter/api/location/regionlistreturnToDefaultLocation()andreturnToHome()actionGo_Home_GlobalData Files
data/regions-geoscheme.tabdata/base_locations.bin.gzdata/iso3166.tabRelated PR: #4956 - Comprehensive Remote Control Enhancement
All reactions