Locate image command

There is a default sub-menu 'Locate image' with this command Image LOCATE=menu,nohide.

I think that this menu or maps services under this menu should be disable if no file is selected, or better if no image is selected, or better if file without coordonate is selected.

Now if I create button with this command Image LOCATE=google, how to disable it with Evaluator if image have no coordonates ?

If I create button Image LOCATE=google in viewer toolbar, button is always hidden :thinking:

I expected this to work...

@enableif:=(IsSet(latitude) && IsSet(longitude))
Image LOCATE=google

... but apparently IsSet() is not one of the functions referenced here:

As well as the above variables, you can also use evaluator functions like IsChecked and IsEnabled to query other information about the state of the Lister.

Evaluator Dynamic Button State

Yes, I use this for Evaluator column but nothing for button...

if (IsSet(coords)) return "yes";

The neatest solution is a little script that filters the selected images and only passes those with GPS info to the command.

Another note about this sub-menu 'Locate image'...

Display the real services names in button labels:

  • google => Google Maps
  • osm => OpenStreetMap
  • bing => Bing Maps
  • etc...

Surprised that this bug is not resolved...

For others to solved this problem...

image

You need to reset option image_locate_services in Preferences / Miscellaneous / Advanced: [Behavior]. The service names are added in brackets and will be displayed after restarting Opus.

Image LOCATE buttons are hidden by default if there's no GPS information; the ones in the submenu are an exception, which are only disabled.

You should be able to use IsEnabled() in the evaluator to use this to check for GPS, e.g. IsEnabled("Image LOCATE") should return true if GPS is available.

Sorry to insist but…

I have 2 images in this folder, with and without coordinates.

Boutons in Lister
I have toolbar with 3 buttons, Image LOCATE=menu, Image LOCATE=menu,nohide and Image LOCATE=google.
Look this video, if no files are selected, items in both menus are not disable and the last button too. Normal ?

Note that Google Earth is not visible in button Image LOCATE=menu,nohide despite keyword nohide. Normal ?

Look now, if the file does not have GPS coordinates, items in both menus are not disable and the last button too. Normal ?

Boutons in Viewer
Look, I have button Image LOCATE=menu,nohide in menu, items in menu are not disable. Normal ?
2023-10-10_112301

Now, I have button Image LOCATE=google that is not display in toolbar even if image have coordinates. Normal ?

Evaluator
This do nothing... Maybe not possible to disable based on metadata ?
2023-10-10_113618

  1. Context stuff won't work in the Lister itself, since determining whether a file has coordinates in it or not is an expensive operation. You could maybe do something with the evaluator, but by default it ignores Image LOCATE commands completely (with the exception of Bing Maps, which we check if it's installed or not) and they'll always be enabled.

  2. In the viewer, we already have the image data so we know if there are coordinates or not. In the main toolbar, Image LOCATE commands are hidden if there are no coordinates. In the menu they're disabled. It's normal Windows behaviour for the parent menu to stay enabled whether the things in it are disabled or not.

  3. I would have expected that to work, but I haven't tried it yet.

  1. Ok I understand that extract date from metadata could be an expensive operation. I didn't succeed with Evaluator, maybe one day someone will...

  2. In my example, file have coordinates, so items in locate menu should be enable and button in toolbar should be visible. That is, currently items in locate menu are always disabled and the buttons are always hidden

  3. Maybe one day...

In the viewer, if the current image has coordinates, items in the locate menu should be enabled and the toolbar button should be visible, yes. That's what happens for me.

I just did some testing and found something, by myself.

I remind you that the problem is that the Locate image menu items are disabled in the viewer even though the image has GPS coordinates in the metadata.
I did a reset of the viewer toolbar and the Locate image menu items are enabled, so there is a problem with the toolbar.
I have the Image LOCATE=menu button in the File menu and I also have an Image LOCATE=google button in my bar.
I removed the Image LOCATE=google button and closed the viewer.
After reopening the viewer, the Image LOCATE=menu menu items are now activated.

So to reproduce the problem:

  1. Reset the viewer toolbar and close it.
  2. Reopen the viewer (so items activated in the Image menu LOCATE=menu in File)
  3. Create a button anywhere in the toolbar with the Image LOCATE=google command.
  4. Close and reopen the viewer.
  5. The menu items are disabled and the created button is hidden.

Now, another test in defaut viewer toolbar, if I move Locate image menu out of File menu and restart viewer… it’s ok, items in menu are still enabled.
If you change this button command to Image LOCATE=google and restart viewer… button is always hidden.

I can't reproduce that I'm sorry. Maybe it depends on the image? Could you upload one that does it for you?

20230825_125425.zip (2.8 MB)

Now that Everything is used to index files and we can add longitude and latitude to the properties scan, could not DOpus take advantage of that ?

So we could add a such a button in a lister toolbar whose state works as expected:

@enableIf:=IsEnabled("Image LOCATE")
Image LOCATE=google