MAP Panel: setting coordinates not working ...

Started by Jingo, October 17, 2017, 03:41:01 PM

Previous topic - Next topic

Jingo

Hmm.. having some issues today!  I just tried to set some coordinates to images using the MAP panel and it is not working.  Here is what I do...

1 - Open IM
2 - Select an Image Thumbnail
3 - Click spot in Map Panel (using OpenStreets).  The Yellow marker shows location
4 - Click button to apply location to selected images - hit Ok.

Notice that the location data in the metadata panel does not update.  I also see that the writeback flag is not set and that reverse geocode doesn't work because there is not location data.

Debug log just for these steps attached.. any reason why it isn't grabbing the coords?

Thx - Andy.

Mario

Nothing in the log file. Map panel works here.

Do you use the Map Panel App as shipped with IMatch?
Did you try to restart IMatch?
Anything logged to the the App Output panel when you do this? (Views > Panels > Output Panel: Apps).

You can also try to open the map panel in your browser (via the corresponding command in the App Manager) and then open the browser console.
Try to set the coordinates for a file. Does this log errors to the browser console?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: Mario on October 17, 2017, 06:13:59 PM
Nothing in the log file. Map panel works here.

Do you use the Map Panel App as shipped with IMatch?
Did you try to restart IMatch?
Anything logged to the the App Output panel when you do this? (Views > Panels > Output Panel: Apps).

You can also try to open the map panel in your browser (via the corresponding command in the App Manager) and then open the browser console.
Try to set the coordinates for a file. Does this log errors to the browser console?

Hi Mario - strange... it just won't work!

Browser option does the same thing... and the output panel remains empty.
Manually adding the coordinates works just fine.... no errors.

Jingo

#3
Ok.. sorry for this... I figured it out...  The files have an archive flag set which was preventing them from being updated.  Strange that I can apply keywords and other metadata.. but the archive flag must be interacting with the way the map panel applies the info? 

The archive flag gets cleared when my full backups run (which hadn't been scheduled for this folder yet).  I wonder what is setting the archive bit in the first place? I will need to investigate that!

Mario

IMatch does not care for the archive file system flag (if this is what you mean?)

The archive flag is set by Windows whenever a file is changed. It is a thing from the old days, where backup software used this file attribute to tell which files were modified. Backup software often resets the archive file after backing up.

Setting GPS coordinates in the Map Panel only updates the database, it does not write back to the file (unless you have enabled immediate background write-back).
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

No.. I do not have write-back immediately turned on...meh.. I take it back... other files do not work and they don't have the archive bit set.... back to square one!

Jingo

#6
Ok.. so this is happening to me again and I cannot figure it out!  This is what I did recently to diagnose...

I deleted the entire programdata/imatch6/webroot/imatch/apps folder (and subfolders).  I then reinstalled Imatch using the Repair option... lo and behold, it correctly rebuilt the app folder and subfolders including the mapapp.

I fired up IMatch, ran the diagnostic and tried to add coordinates to 68 photos... it worked like a charm.  I used metadata writeback on those 68 images and tried to app coordinates to 2 other images at a different spot on the map.. no dice.  Imatch will not add coordinates to those files no matter what.  I then tried to modify the GPS coords using the MAP for one of the images that previously worked - and it won't update.

If I manually update the coords using the metadata panel - all is well except the reverse geocode doesn't work either (either via automatic or clicking the button in the metadata panel).  Seems like something is blocking IMatch from getting the data.. any thoughts Mario??  This is driving me crazy!!

Also - I noticed the following activity while I was trying to perform the map coordinate assign and reverse lookup (which both failed)... any thoughts on maybe something getting blocked by my router?? 




Jingo

Interesting... it seems to NOT like certain places on the map?  Can you please try to assign a photo GPS coords from the map for the following location to see if it works?

Millay Society... this should give you a location of 440 E Hill Rd, Austerlitz, NY 12017, USA

When I try to assign images here - it doesn't work.  However, if I drag the map and click in a nearby location - then the images assign out ok..      :o

Mario

Works here. I performed the steps you requested and I get:

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

I'm at a loss why sometimes it works... sometimes it does not.  Will have to keep playing with the images to see what is going on...   Thx Mario!

Jingo

The mystery thickens!

I used geosetter on the same 4 images and they set the GPS coordinates without issue... IMatch sees the changes and updates the coordinates after a few minutes.  HOWEVER, IMatch still continues to refuse to assign GPS coordinates to these images AND will not perform a reverse lookup- manually or automatically.

So - something is going on with IMatch and the MAP app.  I have no virus software installed, I turned off the firewall (no change).. not sure what else to do except completely uninstall IM and reinstall again... though rebuilding the map application through the installation program only worked one time.

Mario

Reverse geo-coding uses GeoNames.org or Google.
You apparently use OpenStreetMap (OSM) for the map panel.
3 different servers.
Since it works here and there are no similar reports, I assume that some virus-checker or firewall is blocking IMatch sometimes from accessing the network...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

No virus or firewall on my system so I don't think that is it.  I did try something just now... opened the map in the browser and used the developer tools to monitor the network traffic and response.  I noticed I am getting a JSON failed to reverse geo-code the files:

http://127.0.0.1:50519/v1/imatch/metadata/gps
200  POST   gps   127.0.0.1:50519    xhr   json   302B

Params:

lng   -71.18897019276426
lat   42.22464180755739
idlist   @imatch.filewindow.active.selection
auth_token

Response:
  {"result":"failed","resultMessage":"Failed to reverse geo-code the files."}

So - the reverse geo-code is failing the json request... explains why the reverse geo-coding has stopped working.... still doesn't explain why IM refuses to update the database with coordinates...

Jingo

In addition to the above issue, I am trying to debug the gmaps.js program to see why the coordinates are not being retrieved and/or not updating the db.  I can add "trap" into  the app.js program and it displays correctly.. however, adding commands to the gmaps.js program is not working.... should I be able to see the console info when adding data to the following code?

this.onApplyTargetMarker = function()
    {
        if (markerTarget) {
            // Ask the user
            var m = new MapModals();

    console.log("hello");

            m.showMessageBoxYesNo(IMatchTranslate.getStr('MSGBOX_APPLY_TARGET_TITLE'),IMatchTranslate.getStr('MSGBOX_APPLY_TARGET_TEXT'),function() {
                clearUndo();

                console.log("lat:" + markerTarget.getPosition().lat());

                IMatch.setGPSCoordinates({
                    lat: markerTarget.getPosition().lat(),
                    lng: markerTarget.getPosition().lng(),
                    idlist: IMatch.idlist.fileWindowSelection
                }).then(function(response) {
                    // If the update was successful, we reload the files.
                    if (response.result == 'ok') {
                        self.loadFiles(true);
                    }
                });
            });
        }
    }


I'm not getting any hits here or in the other code member functions that should be getting hit when I perform a command... I see the map refresh upon saving the file.. but even a restart of the program doens't produce any hits.

Mario

Are you using Google Maps or OpenStreetMap/Bing?
Google Maps is implemented separately from the other two - the other two are handled via OpenLayers.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

I've tried both (with similar results) but the recent debugging and web review was openstreetmap.

Mario

onApplyTargetMarker is where good things happen.
If you set a breakpoint there, it will be hit. Keep an eye on the console and the "net" tab to see if Javascript throws any errors or if IMatch returns an error from setGPSCoordinates. The IMatch log file should also contiain warnings in that case - but probably only when you run it in Debug mode.

As I said, since it works here with OSM without a hitch, I doubt that this is something general in the code...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

The code in gmaps.js will only be executed when you use Google Maps. Otherwise, the console.log commands should be in ol.js (OpenLayers).
Thorsten
Win 10 / 64, IMatch 2018, IMA

Jingo

#18
Thx guys... I FIXED IT!!!!!!!


Thanks to the use of a  packet sniffer to trace.. (yes = I was going DEEP here!).

Noticed these 2 packets immediately after I hit OK to apply to target:

GET /findNearbyPlaceNameJSON?username=jingo126&lat=42.147275&lng=-71.426048&radius=2.000000&style=FULL&maxRows=1&lang=en HTTP/1.1

{"status":{"message":"user account not enabled to use the free webservice. Please enable it on your account page: http://www.geonames.org/manageaccount ","value":10}}

So - went to that account page and noticed that the "Free Web Services: the account is not yet enabled to use the free web services. Click here to enable" still showed for some reason....... click the link and voila!!  IMatch works just fine.

After doing this - the data saved back to the database as well as the reverse geocode.. so it appears that if the geonames query fails, the info doesn't get updated to the database either... interesting!

Well.. that was FUN!   8)    Thanks again Mario/Thrinn for your patience.... and advice!

Also - the biggest question is they the coords are not being saved to the database...

Mario

You may want to change your user name, now that you've posted it in a public forum!
And I think the message from GeoNames is clear.

I'm not sure about the details, but I think when the reverse lookup fails, the transaction is rolled back entirely.
Try to disable reverse geo-coding in IMatch and see if you can add coordinates.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: Mario on November 09, 2017, 05:37:03 PM
You may want to change your user name, now that you've posted it in a public forum!
And I think the message from GeoNames is clear.

I'm not sure about the details, but I think when the reverse lookup fails, the transaction is rolled back entirely.
Try to disable reverse geo-coding in IMatch and see if you can add coordinates.

Thx Mario.. see above refreshed entry.. I fixed it!  Yes... I had modified the username in the post (that's not my real one... ).  You are corrected about the roll back... I just discovered that.  Thanks for your help/advice!

Jingo

UGHGH!!!  I take it back.. not working again.. too tired to look into this more today... will need to debug the programs in more detail to see why it is not updating the database.. something else must be going on.  UGH!

Jingo

ok.. the saga continues (hope it is ok to detail it all here).  I turned off automatic reverse geocode and that seems to have fixed the issue for now.  Now, I need to figure out... why?  Manual reverse lookup is working.. so why isn't the automatic lookup working and why, when it fails, is it causing the coords not to write to the database?.  Even if the reverse fails, should the coords be written to the DB (we already have them so its just a matter of writing the DB before doing the reverse lookup). 

Off I go into the code......   :o

Jingo

#23
Well.. it is working again.. but not with the reverse geolocation set to automatic...  oh well - more research to come :-X

I'll see how things go over the next few days as I see that I have a LOT of geocoding to do (thx to those new categories)!..

BTW: I was playing around and figured I would share... when I search for a location (F in the MapApp) and click the result link to set the target marker, I always want the location box to go away after clicking instead of hitting X or esc so I'm taken back to the map and to the coordinates...  I added the following code to perform this job [..\mapapp\find\find.js -> function findAddress()].   In case anyone else is interested or if Mario deems this something he wants to add as a feature request down the road.. it would also need to be added to the Geonames.org code just above it.  There might be a way to call the self.close() function which does this as well - but since the result code is translated to HTML - not sure how to easily do that so this works instead.

Existing code:
                        $('#find-result a').click(function() {
                        var a = $(this);
                        var lat = a.attr('data-lat');
                        var lng = a.attr('data-lng');
                        appCore.getMapModule().positionTargetMarker(lng,lat);


Add this to the end...


                        $('#find-container').css('width','0%');
                        $('#find-container').remove();
                        appCore.setActiveOverlay('');


Enjoy!!

Jingo

Just an update: I still haven't figured this one out... but things are working with the Auto reverse geo turned off so that is just fine with me for now....

Must admit - I'm loving the speed of the program more and more since I moved everything to a local drive.. and the auto-window close after location is a very nice too!  Also working on some other ideas ... let's see if I can pull them off before getting ahead of myself!   ;D


sinus

Best wishes from Switzerland! :-)
Markus

Mario

Quote from: Jingo on November 09, 2017, 11:54:01 PM
BTW: I was playing around and figured I would share...

Thanks for sharing. I've added this as the default behavior now - it makes sense.
The correct way to close the overlay is calling self.close() of course. In both the GeoNames and the Google branch.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: Mario on November 12, 2017, 06:21:49 PM
Quote from: Jingo on November 09, 2017, 11:54:01 PM
BTW: I was playing around and figured I would share...

Thanks for sharing. I've added this as the default behavior now - it makes sense.
The correct way to close the overlay is calling self.close() of course. In both the GeoNames and the Google branch.

Thx Mario - funny, I tried using the self.close() function and it didn't work.... figured it was because the HTML code it was building couldn't just call the function directly as the HTML wouldn't know what to do with it... will be interesting to see how you did it in the next release!  Thanks again for including.... Andy.

neonexus

Quote from: Jingo on November 09, 2017, 11:13:14 PM
ok.. the saga continues (hope it is ok to detail it all here).  I turned off automatic reverse geocode and that seems to have fixed the issue for now.  Now, I need to figure out... why?  Manual reverse lookup is working.. so why isn't the automatic lookup working and why, when it fails, is it causing the coords not to write to the database?.  Even if the reverse fails, should the coords be written to the DB (we already have them so its just a matter of writing the DB before doing the reverse lookup). 

Off I go into the code......   :o

OK - I am evaluating iMatch - this is also a problem for me. I am using GeoNames - there is no issue with my GeoNames account. The co-ordinates only get added to metadata panel if automatic lookup is turned off in preferences.

Even after doing that, when I click to update file metadata from database (click yellow pencil) the whole application becomes unresponsive for a minute or so, then a warning triangle icon shows up, saying that an error occurred. Subsequently clicking on the write-back icon seems to update the file.

Manually doing a reverse geocode works OK.

Gotta say, its not a great start to the evaluation.

neonexus

OK - This is the error in the log when the application hangs during metadata write-back:

01.18 17:23:28+1907703 [4158] 00  E>     PTWrapper hangs in ProcessRun for 120000 ms.  'PTETWrapper.cpp(3678)'
01.18 17:23:28+    0 [4158] 00  E> -overwrite_original_in_place


As noted above, after this error I can select metadata write-back and it then seems to update the file with no error. However if I use the menu to wite back for "all pending files" it says there are no pending files; but if I choose "for selected files" (or use the yellow pen icon) it wites back.

Mario

#30
PTWrapper hangs in ProcessRun for 120000 ms. 

This means that ExifTool is unresponsive for more than 2 minutes. This is very unusual and usually indicates

a) Corrupted files or files with badly corrupted metadata
b) A virus checker blocking ExifTool from running, thus badly hurting IMatch
c) Super large files on a very slow drive / network.

This problem will cause side effects everywhere in IMatch. Please give us more details. File formats used? Storage location? Try making IMatch an exception in your virus checker and see if this solves the problem.

QuoteThe co-ordinates only get added to metadata panel if automatic lookup is turned off in preferences.

There are many ways to add GPS coordinates to files in IMatch. Which feature do you use? What is the exact problem?

Also, enable debug logging via Help > Support. This produces more detailed log files.
Then do whatever you do to produce the problem and then ZIP and attach the entire log file.
But first, we need to solve the problem that ExifTool cannot update your files.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ColinIM

Thank you Mario for your 'reminder' above about excluding the IMatch EXE from our anti-virus ("AV") scans!

Although my own metadata Writeback symptoms were not identical to the issues in this thread, I did discover (after reading your reply here today) that my own anti-virus program was wrongly-configured, and because it was not actually 'excluding' my latest IMatch program's 'EXE', I was getting various, seemingly random ExifTool (Writeback) errors on multiple files.

I made a new post about 'correcting' my AV-mistake here:

https://www.photools.com/community/index.php?topic=7665.0

Colin P.