Skip to content

gui: Display EPSG codes in tooltips for Data Catalog locations#7427

Open
polucifier wants to merge 1 commit into
OSGeo:mainfrom
polucifier:gui-display-epsg-codes
Open

gui: Display EPSG codes in tooltips for Data Catalog locations#7427
polucifier wants to merge 1 commit into
OSGeo:mainfrom
polucifier:gui-display-epsg-codes

Conversation

@polucifier

@polucifier polucifier commented May 23, 2026

Copy link
Copy Markdown
Contributor

Description

This PR enhances the Data Catalog tree view by providing immediate spatial context to users. It displays the EPSG code via a native tooltip when hovering over a georeferenced project (location).

Technical Details

  • Native Extraction: Uses g.proj -g inside a temporary isolated environment (gs.create_environment).
  • Lazy Caching: The EPSG code is fetched once and cached in the node's internal data dictionary (data["epsg"]), ensuring that tree sorting and filtering remain instantaneous.
  • Fallback: Safely returns None for unreferenced locations (like XY), rendering them without any extra markup.
  • On-Demand Execution: The projection lookup is triggered exclusively by the wx.EVT_TREE_ITEM_GETTOOLTIP event. This ensures the heavy g.proj call only happens when the user actively hovers over a location, preventing any latency during application startup or tree initialization.

How to Test

  1. Open the Data Catalog panel in the GRASS main window.
  2. ​Hover the mouse cursor over any georeferenced project (location) name.
  3. ​Verify that a native tooltip appears after a short delay showing EPSG:XXXX.
  4. ​Verify that the tree interface remains responsive and that no errors are triggered in the console during hover.

Visuals

IMG_20260526_215722_944.jpg

@ecodiv

ecodiv commented May 23, 2026

Copy link
Copy Markdown
Contributor

Would it be possible to make this optional? I can see why this is possibly handy, but for me it would add clutter.

@polucifier polucifier marked this pull request as draft May 23, 2026 14:10
@github-actions github-actions Bot added GUI wxGUI related Python Related code is in Python labels May 23, 2026
@echoix

echoix commented May 23, 2026

Copy link
Copy Markdown
Member

Could it show up in the tooltip if it already doesn’t do it normally?

@echoix

echoix commented May 23, 2026

Copy link
Copy Markdown
Member

Having it optional, enable per project would avoid having to do these calls only for the GUI, (slowing down the initial loading). Similar to how the number of features of a layer isn’t systematically counted and displayed in QGIS, you have to enable it for the layer if wanted.

- Implemented OnItemToolTip to display the project's EPSG code upon hovering.
- Used tree model search to resolve the node from item text, ensuring compatibility
  with the virtual tree structure.
- Cached EPSG code in node data to avoid repeated shell calls and preserve performance.
@polucifier polucifier force-pushed the gui-display-epsg-codes branch from 26e6593 to f400716 Compare May 26, 2026 19:35
@polucifier polucifier marked this pull request as ready for review May 26, 2026 19:58
@polucifier polucifier changed the title gui: Display EPSG codes next to project names in Data Catalog gui: Display EPSG codes in tooltips for Data Catalog locations May 26, 2026
@petrasovaa

Copy link
Copy Markdown
Contributor

#5294 and #7297 are related. I am honestly not sure this feature is needed...

@polucifier

Copy link
Copy Markdown
Contributor Author

#5294 and #7297 are related. I am honestly not sure this feature is needed...

I feel like having this in a tooltip is more convenient and expected than calling "show projection info" from the context menu for each location or changing the current mapset to see the CRS in the status bar. It provides instant, zero-click access to the EPSG code just by hovering, which is faster when browsing through multiple projects.

If you think this alternative UX isn't needed, let me know and I will gladly close this PR. Thanks!

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

Labels

GUI wxGUI related Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants