Map - Edit Locations

Started by Aubrey, February 24, 2019, 01:03:13 PM

Previous topic - Next topic

Aubrey

I'm using the Map function to identify locations and cross reference them with an old geological map (not much to do with photography)

The Edit location function shows the coordinates in decimal degrees. It's a bit of a hassle to convert to degrees and minutes (read I'm am being lazy).

Would you be able to tell me which java script file is used to grab this information? I suspect I may well be able to select a different output to have degrees and decimal minutes.

See attached jpg to show what I would like to change.

Thanks,
Aubrey.

Mario

This is a native IMatch dialog. It's not created by an app or script.
It uses decimal coordinates because that is the naive format for metadata, IMatch, all map providers etc.

When you google for convert gps coordinates to degrees you'll find some online converters which allow you to quickly convert between both coordinate formats.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

OK just wondered if there was something there. Anyway it's not too onerous to convert to minutes: take the decimal part and multiply by 60!
Thanks
Aubrey.

Jingo

#3
I believe the app I wrote awhile back might help you out here ... please check out the Geodata "dipslay" Converter app (spelling mistake and all!)  :D   

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



Aubrey

Hi Andy,
I've downloaded the zip file and placed the contents in C:\ProgramData\photools.com\imatch6\webroot\user

A couple of things:
I'm not seeing anything in the apps panel?
There are 2 files in the directory geo-convertor, app.json and geo-convertor.png

The app.json is24 lines, I don't see code to convert inside this file - should I?

My first time to start looking at apps. Perhaps I'm missing something fundamental...

Thanks,
Aubrey.


thrinn

I also tried to download the ZIP file but it seems to be damaged (?). I get a CRC error when I try to unpack it.

QuoteThe app.json is24 lines, I don't see code to convert inside this file - should I?
This is only the configuration file. It is normal that it is short and does not contain any code.

There should be also at least a HTML file (index.html mostly) which contains the actual code and app UI. This seems to be missing.

I seem to remember that on a lot of older posts the ZIP attachments got scrambled at some time in the past. Maybe this is also the case here?
Thorsten
Win 10 / 64, IMatch 2018, IMA

Jingo

Wow.. sorry guys.. not sure what happened to the zip file but I suppose I'll need to go through the list and update them all.  In the meantime, I've attached another version that does contain all the necessary files.. I have NOT tested it with the latest update but since it is just reading XMP data and performing calcs.. all should still work ok.  Please let me know! - Andy.

Aubrey

#7
Andy,
Thank you. now installed, a nice piece of code and it will be useful.  :)

I'm making an effort to understand what went into the code !
I think that you wrote the "index.html" part. When coding this up did you use a dedicated text editor or something more sophisticated.

It's time that I spent some effort to learn how to make these wonderful apps.

Aubrey.

PS: "dipslay" spelling error sorted for me!

PPS: Are there any DAMs out there which have all the facilities that Mario has built in for us? Certainly not at the price Mario is selling IMatch... The more I use this piece of software the more impressed I become, after 11 years of use I am still learning new features! Thanks Mario.


Mario

#8
QuoteI think that you wrote the "index.html" part. When coding this up did you use a dedicated text editor or something more sophisticated.

Check out the IMatch Developer Center for links to great and free software to edit HTML and JavaScript files. I recommend the free Visual Studio Code, because it is just great. Works on all platforms, is written in JavaScript (!)...

IMatch includes the documentation for all functions ("endpoints") supported by the integrated IMatch Web Services. Just run the IMWS Documentation app from the App Manager.

For tutorials, code recipes, tips & tricks see the IMatch and IMWS documentation online. IMatch comes with over 20 sample apps which demonstrate different aspects of writing apps, from accessing files, search, sorting to modifying metadata etc.

I know that the high-end DAM systems (20,000K$+ annually) have programming facilities (usually you hire a consultant from the vendor to do the customization/programming for you). I'm not really looking at lower-end DAM software  ;)

The key technology for programming IMatch are IMatch WebServices. They offer a programming-language independent interface to IMatch and the IMatch engine. To write apps running 'in' IMatch you use HTML and JavaScript. But to just access IMWS functionality you can use any modern programming language, from Windows PowerShell to Python (I use that a lot to run automatic tests) to Java to .NET. This is extremely flexible, powerful and modern. Not sure if there is another DAM which offers that


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

Jingo

Quote from: Aubrey on February 25, 2019, 07:26:26 AM
Andy,
Thank you. now installed, a nice piece of code and it will be useful.  :)

I'm making an effort to understand what went into the code !
I think that you wrote the "index.html" part. When coding this up did you use a dedicated text editor or something more sophisticated.

It's time that I spent some effort to learn how to make these wonderful apps.

Aubrey.

PS: "dipslay" spelling error sorted for me!


My pleasure Aubrey - this was one of my early IM scripts so not "wonderfully" coded but it gets the job done.  Yes, the index.html is where all the coding magic occurs.  As you can see, there are a few "sections" to the program... the HTML section  and the  SCRIPT section.  The HTML is where you build the user interface ... buttons, text boxes, headers, etc.  I call this - the "easy part".  You can easily search the internet to find things to add here if you need assistance. 

The SCRIPT section is where the javascript code goes and this is where the true programming part of things come in.  Global variables (used in multiple functions) go at the top.  Then, each function is coded. 

The main function for this script is the loadFileData function.  This function accesses the IMATCH data (in this case it simply returns the id of the focused file) and then calls javascript conversion functions to do the math... and outputs the result back to the HTML elements for display in the User Interface.  Most of the functions I looked up on the internet and they were freely available for use... that is the beauty of javascript - it is so widely used that there is bound to be an example or two for free use out there. 

I'd like to mention that I also try out scripting on site like https://jsfiddle.net - you can see instant results from standard (non-IMatch) javascript calls to ensure code is doing what you expect before running it in IM... quite handy!  https://www.w3schools.com is another helpful site to get started and has it's own coding area as well.

Hopefully this helps.... let me know.. always here to help! - Andy.

Aubrey

Hi Andy,
I've played with your script to get my head around the functions.
Only a few simple things, I added a prefix zero when seconds or minutes are less than 10

I also added a row showing Degrees and decimal minutes - probably not coded the most efficient way but it works!

I've started to look at UTM, and reduce the number of decimal places, but solved that yet. I don't want to go into the utmconv.js to make changes.

For me the hardest part to get my head around is the continuous updating; your code is nicely commented so this helps.

I'm using Visual Studio for editing.

thanks,
Aubrey.

Jingo

Very nice Aubrey... glad the comments are helpful... I tried to add them in so I would remember what I did and why months/years later... the company I work for does not allow comments within the function - only summaries at the top for quicker compiling and easier readibility when troubleshooting thousands of lines of code... but I'm an old school programmer and prefer to add comments around major sections of code.

Good luck with learning JS and IM scripting... there are some more advanced concepts that don't make sense at first like asynchronous flow and promises, etc... but once you get your head around it - it's not too bad to follow!

VS is great... I tend to just use an editor like UltraEdit (because I own it and have it installed already) - but VS makes things a lot easier.  One other item to get the hang of... the built in developer functions within the browser... F12 in firefox for example.  Gives you a very fast way to review network traffic between your app and IM when things just aren't going right!

Good luck and enjoy!

Mario

And the developer tools allow you to set breakpoints in your code, step though, inspect variable contents etc.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Quote from: Jingo on February 25, 2019, 10:08:44 PM
VS is great... I tend to just use an editor like UltraEdit (because I own it and have it installed already)


I'm also an Ultraedit user, I bought it originally about 20 years ago, I later bought a perpetual license.

A good piece of software, however I'm seeing suggested keywords etc. when I use VS.

Aubrey.

Jingo

Quote from: Aubrey on February 26, 2019, 12:44:07 PM
Quote from: Jingo on February 25, 2019, 10:08:44 PM
VS is great... I tend to just use an editor like UltraEdit (because I own it and have it installed already)


I'm also an Ultraedit user, I bought it originally about 20 years ago, I later bought a perpetual license.

A good piece of software, however I'm seeing suggested keywords etc. when I use VS.

Aubrey.

Agree - I like it for coding as well.  Check out the Autocomplete and JSLint functionality within UE... similar ideas to VS though VS is MUCH more fluid for coding. 

Mario

#15
"ESLint" extension for JavaScript.
"Bookmarks" for setting bookmarks in source code.
"HTMLHint" for automatically analyzing HTML code
"GitLens" if you work with Git (and GitHistory, if you like)
"TSLint"for TypeScript

There are similar extensions for other programming languages, e.g. for Python, Java, PowerShell (much better user experience and debugger than the official PowerShell IDE).
I write all apps with it, and also IMatch WebViewer.
The IMatch help system and the customer portal is maintained using VSCode.
I even write Arduino Scripts in VSCode, because its much better than the official Arduino IDE  ;D
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook