Author Topic: Would like to convert Lat Long to OSGB 36  (Read 12958 times)

Calobata

  • New Members
  • *
  • Posts: 26
Would like to convert Lat Long to OSGB 36
« on: December 11, 2015, 02:27:35 PM »
Not familiar with scripts yet and I've chosen one of the hardest things to think about.
There are plenty of online routines to do the conversion from geotagged Lat Long data to Ordnance Survey OSGB 36 but all the ones I know of require a copy and paste from single images.
I'd like to be able to write to an otherwise unused location field (City perhaps)

Way too ambitious for me but if anyone makes a start I'd like to know.

Why? Because images of flora and fauna are increasingly being used for biogeographical recording and the standard grid in the UK is OSGB (other countries have such grids too) which is extensively used to record such data. Examples: NBN Gateway. iSpot, iRecord

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Would like to convert Lat Long to OSGB 36
« Reply #1 on: December 11, 2015, 04:46:31 PM »
The Metadata sample script shows how to access metadata (e.g., the XMP GPS tags). It also shows how to write data to tags (e.g., the City tag, although there are probably better tags for your purpose). You only need to plug the maths in-between.

The Scripting help in IMatch explains how the metadata classes work and how to use them.

Start by writing a script which loads the GPS tags for each selected file and outputs them in the output window.

Then calculate the OSGB values for each coordinate pair and output them as well.

This will be nice and rewarding challenge for a weekend if you have not scripted before.
If you got this working, all you need to do is to store your calculation results into another suitable tag.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #2 on: December 11, 2015, 07:48:00 PM »
There was an excellent script for IMatch 3.4 by Khododad which did precisely this.  It involved a complex script which incorporated some source code which was found on the internet.  This code had to reside in one of the IMatch system folders.  I cannot recall the details,  but this link might be a starting point - http://www.movable-type.co.uk/scripts/latlong-gridref.html .  The script converted Lat-Long to OSGB coords in format AAeeee nnnn, where AA is alphabetic representation of the 100km square and eeee/nnnn are the eastings/northings to nearest 10m, always rounded down.

I would be interested in such a script for the same reasons as the OP, but do not have the skills to write one.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #3 on: December 11, 2015, 10:40:17 PM »
If you still have that script Peter, it could most likely be migrated to 5.x

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #4 on: December 11, 2015, 11:29:34 PM »
If you still have that script Peter, it could most likely be migrated to 5.x
Ferdinand - I have not kept IM3.4 stuff, but if someone could say how to find the old blog which had all the scripts,  I could probably find it.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #5 on: December 11, 2015, 11:39:48 PM »
I have hunted around and found this link
http://ptforum.photoolsweb.com/ubbthreads.php?ubb=showflat&Number=3906#Post3906
Unfortunately I cannot get beyond this, as further links take me too IM5.5.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #6 on: December 12, 2015, 12:16:15 AM »
This was something that I was unhappy about, TBH.  The old Wiki with the scripts was disabled without warning, meaning that we had no chance to download and retrieve things.  Things like this particular script were useful, even now, as they contained a lot of clever code that could be migrated.

I don't delete much (should delete more), and will see if I have a copy of the final.  Possible but unlikely.

Mario:  Is there any chance that a script from the old Wiki could be retrieved for migration purposes?

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Would like to convert Lat Long to OSGB 36
« Reply #7 on: December 12, 2015, 09:08:26 AM »
I had to close, burn and wipe the old Wiki because it had been hacked and infested with links to SPAM sites, fake articles with advertisements etc.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #8 on: December 12, 2015, 09:21:11 AM »
I've got a stash of old stuff, but not that.  Sorry Peter.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #9 on: December 12, 2015, 11:41:49 AM »
Ferdinand - I have found it amongst a load of stuff in my Downlaod folder!  See attachment.

The script needs too operate with Grid Inquest.  It was written in conjunction with v 6.6.  Here is the link for v 7
http://grid-inquest.software.informer.com/7.0/

[attachment deleted by admin]

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #10 on: December 12, 2015, 11:59:56 AM »
Good.  Give me a little while.  It's that time of year and I have a few seasonal jobs on.   But it's not a big script, so shouldn't take too long once I get to it, and and get my head around Grid Inquest.   :o

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #11 on: December 12, 2015, 12:10:47 PM »
Good.  Give me a little while.  It's that time of year and I have a few seasonal jobs on.   But it's not a big script, so shouldn't take too long once I get to it, and and get my head around Grid Inquest.   :o
That would be magnificent.  Grid Inquest is very technical, as it must solve some complex maths, but it I think it does everything needed with variables provided by the script.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #12 on: December 12, 2015, 12:53:26 PM »
From a quick glance, I take it that Grid Inquest installs as a stand alone program, but the script just uses one of its DLLs. Does that sound right to you?

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #13 on: December 12, 2015, 01:04:43 PM »
From a quick glance, I take it that Grid Inquest installs as a stand alone program, but the script just uses one of its DLLs. Does that sound right to you?
I cannot remember the detail and do not know about DDLs.   Khodoad arranged with Mario for the GI program to be included with the IM download file.  It resided in the main installed IM Program folder, where I assume the script accessed it.  If in future Mario would not wish to include this in IM5 updates, we would presumably have to put the program in an appropriate folder each time an update is installed.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #14 on: December 12, 2015, 11:54:04 PM »
I'll install it and see if I can work it out, otherwise I'll need to seek advice from Mario.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #15 on: December 13, 2015, 12:58:34 PM »
I look forward to the results.  In IM3.4, I had to tell the script what supplemental keyword to place the converted coords.  In IM5.5 it would be best if this were done by the script.   

After initial implementation with OSGB, extending the script to UTM (worldwide) coords might be considered.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Would like to convert Lat Long to OSGB 36
« Reply #16 on: December 13, 2015, 01:26:53 PM »
I gave Google a try.
I thought that there is maybe a web service you could use, similar to GeoNames (sample app in icluded in IMatch). Web services are 'the thing' anyway.

The first hit was

http://www.movable-type.co.uk/scripts/latlong-gridref.html

which allows you to enter data and convert it. It explains some background, links to the official size and also offers the JavaScript code to perform the conversion. I did not dig deeper or can judge how precise the results are.

But probably it would be easier to write an App for the App panel in JavaScript and utilize the code made available by the site mentioned above. Instead of fiddling with external DLLs., interfaces and other nasty things.

Running this in JavaScript in the App Panel also opens up many other possibilities, e.g. to use the web services offered by the BGS.

Interesting are also

http://www.ordnancesurvey.co.uk/gps/transformation

and their batch conversion service:

http://www.ordnancesurvey.co.uk/gps/transformation/batch

Here you apparently only provide a file with coordinates in a format which should be easily to create in IMatch using the text exporter and you get back the matching coordinates.

Just to give you something to check out.


Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #17 on: December 13, 2015, 01:35:50 PM »
I cannot remember the detail and do not know about DDLs.   Khodoad arranged with Mario for the GI program to be included with the IM download file.  It resided in the main installed IM Program folder, where I assume the script accessed it.

Are you sure about all this? I haven't installed it yet, but looking at the script there's a reference to a file from this location:
C:\Archivos de programa\Archivos comunes\Quest\Geodetics\GIQ60.dll#GIQ60 1.0 Type Library#GIQ60Lib

Now allowing for the fact that khodadad was a Spanish speaker (or perhaps Portuguese), this reads to me as if he just installed GI and it installed all that was required, and he just picked up the installed DLL.  If you really did need to place a file somewhere, it may have just been because the reference to the reference needed to be translated into English.

p.s.   I've seen Mario's reply, but I'm only trying to help Peter out with a script migration service.  I don't have any inherent interest in this, and no experience yet in IMatch apps.
« Last Edit: December 13, 2015, 01:38:01 PM by Ferdinand »

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #18 on: December 13, 2015, 01:54:37 PM »
I am sure that a program was included in the main IM3 folder - Khododa made this point and I recall his request to Mario.  I could not be sure which program.   The reference you give is for a Grid Inquest product - http://docslide.us/documents/gridinquestprogrammingmanual.html .

I do not mind how this is done and I would not want you to put over-much effort into this.  If Mario's suggestions are more convient/practicle for IM5, that is OK for me. 

jch2103

  • Oldtimer
  • ****
  • Posts: 2265
Re: Would like to convert Lat Long to OSGB 36
« Reply #19 on: December 13, 2015, 09:45:13 PM »
After initial implementation with OSGB, extending the script to UTM (worldwide) coords might be considered.

+1 from someone on the other side of the pond...
As Mario suggested, an online conversion resource might be useful here, if one exists that can do a range of conversions.
John

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #20 on: December 13, 2015, 10:47:16 PM »
+1 from someone on the other side of the pond...
As Mario suggested, an online conversion resource might be useful here, if one exists that can do a range of conversions.
John -  I do not know what grid system is used in USA. If conversion to UTM grid is what you want, it can be done off line with GridInQuest - I have v.6.6 which can be downloaded free from http://grid-inquest.software.informer.com/6.6/ .  I think that the latest version is 7.  The trick I want is to interface this, or similar, to IM5, so that the converted coords are stored in an image's metadata,  without having to enter them manually.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #21 on: December 15, 2015, 10:54:30 AM »
Short version:  things are looking promising, but I need more information.

The good news is that the script still seems to work in IMatch 3.6.0.18 with just two small changes, if you install the latest version of GI.  It may actually work without those changes if you have the older version of GI installed.

But my problem is that I don't know what it's supposed to do.  So I can't really test it in 3.6, and I'm a little unsure of how to migrate a couple of key aspects to 5.x.

Peter - I need you to tell me what this script is supposed to do and precisely how the database was supposed to be set up in order to use it.

It appears that in 3.6 it took a text string from a specified property field [edit:  or EXIF], did a conversion and placed the result in another properly field.  Is that right?  How were the property fields named?

I'll need to migrate this to Attributes and will need to decide how to specify and name an attribute set.

Doesn't appear to be a big job.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #22 on: December 15, 2015, 05:50:29 PM »
Ferdinand - thanks.

The script is designed to convert Latitude/Longitude (LL) coords  held as exif data in an image file to British National Grid (BNG) coords.  OSGB is explained in this link:
https://en.wikipedia.org/wiki/Ordnance_Survey_National_Grid

In brief any point in UK can be defined as the distance in meters east (Eastings) and north (Northings) of a point of origin (POO) somewhere west of Lands End.  So a place might be at Eastings 536927  and Northings 347254,  536.927km east of and 347.254km north of the POO.  For general use, the Ordnance Survey converts the first figure of each part to a 2-letter code,  representing a 100km square;  in the example SP,  so that the reference would be shown as SP36927 47254 .

The script uses the GridInQuest programme to convert LL to the 6-figure Eastings and Northings,  then it assigns the letter code, and rounds the reference down to the nearest 10m,  so that the example becomes SP3692 4725. 

I have reinstalled 3.6.18.  This did not have the the GridInQuest file, so I have placed a file GIQ60.dll (which I think is the one needed) in the program folder,  but the script no longer works.   I cannot completely recall the mechanics.  Running the script placed the BNG coords in a properties field BNG_ref (or I might have put it there manually - cannot remember). I then used APIW to copy the coords into IPTC Custom Field 1.

Sorry I cannot be more specific.

Afterthought  If possible the script might be modified to put the converted coords direct into an XMP tag.
« Last Edit: December 15, 2015, 08:33:30 PM by DigPeter »

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #23 on: December 15, 2015, 11:47:53 PM »
I understand the principle of what it's doing, i.e. the conversion from one coordinate measurement system to another.  The question I was trying to ask was how this operated in IMatch.  It seemed to read either from EXIF or a property.  How did you get the coordinates into properties in the first place, or did you always choose EXIF?  The destination property was already created I assume?  I'm trying to work out how to set up the attributes to store the conversion, since properties were simple whereas attributes are a little more sophisticated.

I guess storing in an XMP field is possible, but which one?  I don't like the idea of creating a new field, and most existing fields already have a purpose.  This is just a simple migration exercise for me, and I'd just like to get it working quickly and easily.  Enhancements are another matter.  You may be able to use a metadata template to move the data from attributes to xmp.

Putting the right dll file in the right place isn't sufficient.  You need to register it with Windows.  So that's why you need to install GI, and then make sure that the reference to the DLL and the associated database is correct in the script.  I could send you a version of the 3.6 script with the minor changes needed for it to work with the latest version of GI, if that would help you refresh your memory.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #24 on: December 16, 2015, 01:03:07 PM »
Many of my photos are downloaded from camera by Downloader Pro which embeds the GPS coords into exif, from where the script reads them. As far as I can recall, the script operates on files which have been selected in IM and automatically transfers the converted coords to IM, placing them in the property field BNG_ref.  In one of his posts to this thread,  Mario suggests putting the results in a suitable tag, implying that on would be created, if there are none spare.

I am sure that the script operated only on the GI file(s) lodged in the IM program folder. I have put two files which might be relevant intoDropbox - https://www.dropbox.com/sh/wh5lbhkqz21f145/AADw9ovTbITie6Vy-21zda9Ga?dl=0 .

Yes please - I would like the amended script.  (Sorry about the memory thing- put it down to advancing senility.) 

I wonder what happened to Khododad?  I have tried to contact him, but he must have changed his email address.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #25 on: December 16, 2015, 01:27:07 PM »
Are you sure that DLP puts the GPS coords in the JPG EXIF and not an XMP sidecar?  You may be right, but I've had trouble rating in BBP and ended up with sidecars that I didn't want.  Perhaps there's a setting.

3.6 script attached.

I'll turn to it again in a day or so.  I'd specify an attribute set and field.

khodadad did put in a brief appearance last year some time, but hasn't been seen again since.  A real pity, but then almost none of the real old timers are still around any more, other than Richard and me, and Richard is pretty quiet (no-one would ever accuse me of that).  Instead we are growing a crop of new old-timers.

P.s.  I think the files in that dropbox folder are redundant if you install GI7.

[attachment deleted by admin]
« Last Edit: December 16, 2015, 01:30:41 PM by Ferdinand »

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #26 on: December 16, 2015, 03:43:55 PM »
Short answer is both sidecar & exif.  My raw originals (normally converted by Lightroom) have GPS in the XMP sidecar.  There are no sidecars for my jpg originals or versions and GPS data are in both exif and in XMP.  I have idea how that happens, except initially through DLP,  or occasionally IM maps, Geosetter, or BBpro. I will do a few tests away from IM & LR to see what happens.

I note that the script contains several instances of "exif", but none of "xmp".  The script was written in 2007, for IM 3 when there were no raw files in the database.  I suppose that if is to function with raw files, then it will need to interface with sidecars too.  Please do not hesitate to say if this is getting too time consuming.

Thanks for the revised script, which I will test.  I am not sure what to do with or where to put what GI file(s).  I see the revised script has a line: C:\ProgramData\GridInQuest\GIQ60 - what goes there?  I have the GI6.6 program already installed in the program folder Quest Geo Solutions Ltd/Grid InQuest .  I can use this manually to convert coords.

I found the attached file in my Grid InQuest program folder,which might be of interest or help.


[attachment deleted by admin]
« Last Edit: December 16, 2015, 03:49:37 PM by DigPeter »

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #27 on: December 16, 2015, 09:31:29 PM »
I have run the script in OM3.6.  It works up to the point of conversion, but then does not produce an answer.  The script produces a dialog, where the parameters for conversion are selected - see attached.  This shows the parameters used in my test:  Great Britain; from exif - ETRS89geodetic; to BNG_ref - OSGB36.  For some reason it does not put the converted cooords in BNG_ref.  I suspect that this is something to do with the location of the GIQ60.dat file.  I have placed this in the IM3 program folder  and it is in the folder where it was installed  C:\Program Data/Quest\GIQ60.  I amended the 2 lines in the script: C:\ProgramData\GridInQuest\GIQ60 to C:\ProgramData\Quest\GIQ69.

The procedure is to select image files and run the script.  The dialog appears and having made sure that the correct settings have been made, click on OK and the BNG_ref property of each file should be populated with its converted coord.  In case you ask, the files I am testing are from GB and have GPS data in exif. 

Addendum
Another attachment shows where the script stop, awaiting some variable.

[attachment deleted by admin]
« Last Edit: December 18, 2015, 03:18:32 PM by DigPeter »

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #28 on: December 20, 2015, 10:56:04 AM »
Peter, my attitude is that if we can't get it working again in IMatch 3.6.0.18 then there's no point attempting to migrate it to 5.x

I ran the script in 3.6 and while the script ran, it didn't put anything in the BNG_ref property, i.e. same as you.  The problem is not the location of the database, at least I don't think so.  I left it where the install of GI put it, and adjusted the script to reflect that location.  I *think* you can put it anywhere you like so long as the location specified inside the script matches.  I chose to leave it where GI7 installed it.

That's not why there's no result.  If you run the script and then open the scripting output in IMatch 3.6 you will see an error message:
Error eInvalidCoordinate converting E:\My Photos\xxxxxxxxxxxx.jpg

The image I was using was shot in downtown Bristol.  I assume that's covered by the BNG system.  So I don't know why there is this eInvalidCoordinate error message.  I checked that the script is getting the correct GPS coordinates from the JPG EXIF and is inserting them into the commands to sends to the DLL.

My only guess is that GI7 has changed in some important respect, and the script isn't sending the correct commands to the DLL.  I can't find a programming manual for V7.  The link you provided is for V6.6.  As far as I can tell the commands are the same, but even so, something is not right.

I don't understand the error you got.  I didn't see that.  I can tell that installing GI7 installs the DLL in a manner and place such that IMatch can find it - there are clues to this in the script.  So the DLL is fine and the .dat is fine as far as I can tell. 

I need one of two things - either a programming manual for V7 or the version of GI that was current back when khodadad wrote the script.  Without either of those things I can't make any progress.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #29 on: December 20, 2015, 01:10:50 PM »
Thank you Ferdinand,

The version I am using and I am sure for which the script is written, is in my Dropbox at https://www.dropbox.com/sh/wh5lbhkqz21f145/AADw9ovTbITie6Vy-21zda9Ga?dl=0

I agree that we must first get it back to working order on IM3.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #30 on: December 20, 2015, 01:37:25 PM »
Have you got this 6.6 version installed at present?  If you have it installed, and using the script as Khodadad sent it to you, does it work in IMatch 3.6?  I'll try this a little later, but it would help to know that it does for you.  If you have V7 installed you may need to uninstall it before you reinstall V6.6.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #31 on: December 20, 2015, 02:02:19 PM »
I have 6.6 installed and it performs as I have described in earlier posts.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #32 on: December 20, 2015, 02:08:20 PM »
So with the script installed as khodadad wrote it, and with GI6.6 installed, it's not working in 3.6.  That's not very encouraging.  Hmmmmm

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #33 on: December 20, 2015, 04:00:21 PM »
Indeed ... Hmmm

Please do not labour on this - unless, of course you are up for the challenge!

Would the format of the Lat/Long reference be something to do with it?

Edit  I have just downloaded some jpg images with DLP, applying GPS data.  Exiftool shows GPS in following formts:

exif tag:    dd mm.mmmm
XMP tag:  dd mm ss.ss , which is the format displayed by IM 5 . (I have yet to check on IM 3, as it is on another computer, which I cannot access just now.)

Grid Inquest 6.6 accepts Lat/Long in any format which has to be selected in preferences.
« Last Edit: December 20, 2015, 04:58:50 PM by DigPeter »

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #34 on: December 20, 2015, 10:23:44 PM »
I tried a few couple of formatting options to no avail.  I have one or two other ideas, but after that it looks like a dead end, until I get a flash of inspiration.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #35 on: December 21, 2015, 12:49:36 PM »
I cannot recall whether the script worked with IM3.6 .  At some stage, while we were testing IM5, Mario changed the script software, which requires some small change to existing scripts.  The script certainly worked with an earlier version of IM3, possibly IM3.4 .  Perhaps the problem relates to the new script software?  I realise that you must have made some change for it function at all, but is there something else?

In case you have not found the user manual for GI6.6, it is attached.

[attachment deleted by admin]

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #36 on: December 21, 2015, 12:55:39 PM »
Thanks Peter, I've got the manual from a link you gave earlier in this thread.   I assume it's the same.

I have an idea, but I won't now have the chance to look at this again until next week.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #37 on: December 21, 2015, 01:06:39 PM »
I have an idea, but I won't now have the chance to look at this again until next week.
Great - have a good Christmas.

Just checking that you picked up from an earlier post that GI6 is in program folder Quest/ - different to GI7.

Rhadamanthys

  • Jr. Member
  • *
  • Posts: 52
Re: Would like to convert Lat Long to OSGB 36
« Reply #38 on: January 08, 2016, 05:18:02 PM »
Conversion is a bit tedious as pointed out in Wikipedia. It takes these steps:

1. Convert ellipsoid coordinates (latitude, longitude) to cartesian coordinates  (x,y,z) using WGS84 ellipsoid data
2. Shift the cartesian coordinates by the appropriate dx,dy,dz parameters
3. Convert cartesian coordinates  (x,y,z) to ellipsoid coordinates (latitude, longitude) using Airy 1830 ellipsoid data
4. Perform Transverse Mercator Projection on ellipsoid coordinates (latitude, longitude)
5. Calculate the grid letters and digits

I do have VBA functions for coordinate conversions and projections mentioned above running in MS Excel 2000. Those should run in iMatch's WinWrap Basic as well. If you are interested I can provide them without support.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #39 on: January 08, 2016, 11:11:18 PM »
@Rhadamanthys - why don't you supply them and then we can assess how easy they are to adapt to IMatch?  Thank you.

@Peter - the trouble with the holiday season is that I've forgotten that last idea I had.  Hopefully it will return.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #40 on: January 08, 2016, 11:31:00 PM »
@ Ferdinand - LoL, you must be nearly as old as I am.

@Rhadamanthys - all of this is done by Grid InQuest, except allocation of sector letters.  What is needed is a script to transfer the result, including sector letters, to IM5 such as that which worked in IM3.


Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Would like to convert Lat Long to OSGB 36
« Reply #41 on: January 08, 2016, 11:50:17 PM »
Peter, the point of Rhadamanthys' comment was that if we can't get GQ to work, and that's a distinct possibility, then his routines might be able to be used in a completely different conversion script.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #42 on: January 09, 2016, 12:59:52 PM »
Peter, the point of Rhadamanthys' comment was that if we can't get GQ to work, and that's a distinct possibility, then his routines might be able to be used in a completely different conversion script.
Fair enough - more ways to crack a nut....

Rhadamanthys

  • Jr. Member
  • *
  • Posts: 52
Re: Would like to convert Lat Long to OSGB 36
« Reply #43 on: January 11, 2016, 10:05:32 PM »
Attached is my ready to use converter. Have fun!

[attachment deleted by admin]

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #44 on: January 11, 2016, 11:28:28 PM »
Attached is my ready to use converter. Have fun!
Thanks - i will report after I have tried it.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #45 on: January 20, 2016, 09:41:46 PM »
@Rhadamanthys

I have tested the script with the following lat/lon data in the line Lat 52#; lon 0#:

      GPS Geo          GPS BNG    Script BNG (integers only)

lat: 51.28242    N:  (1)53842      (2)53973   
lon: -1.45852    E:  (4)37862      ( )37674

The GPS geo and BNG coords were taken from a Waypoint reading on my GPS.  (These figures are close to a conversion made with Grid Inquest from Geo to BNG (15m for N & 1m for E)

The figures in brackets represent the 100km square.  Presumably the absence of the figure in the scripts E coord is equivalent to zero.  So the script places the point in the wrong 100km square.  Within the 100km square, the BNG differences are N: 132m and E: 188m.

Rhadamanthys

  • Jr. Member
  • *
  • Posts: 52
Re: Would like to convert Lat Long to OSGB 36
« Reply #46 on: January 23, 2016, 07:57:21 PM »
One of the reasons is I left the scale factor at 1 which does not apply. The x,y,z offset may also need review as I derived this from an old record. The major issue however is I believe the Transverse Mercator Projection used in GB with its true origin at 49N,2W cannot be handled by my routine. It works well for UTM and German DHDN which both originate at 0,0.
I notice that https://www.ordnancesurvey.co.uk/docs/support/guide-coordinate-systems-great-britain.pdf gives a complete set of formulas to properly transform so you may want to develop code from these.

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #47 on: January 23, 2016, 08:51:12 PM »
Thanks for your interest.  Trust UK to do things differently from the rest of the World.

Rhadamanthys

  • Jr. Member
  • *
  • Posts: 52
Re: Would like to convert Lat Long to OSGB 36
« Reply #48 on: January 26, 2016, 08:36:20 PM »
The Swiss do too.
if you ever need to convert from WGS84 to the swiss grid feel free to contact me again. This one works for sure...

DigPeter

  • Super Hero
  • ****
  • Posts: 1247
Re: Would like to convert Lat Long to OSGB 36
« Reply #49 on: January 26, 2016, 10:59:05 PM »
The Swiss do too.
if you ever need to convert from WGS84 to the swiss grid feel free to contact me again. This one works for sure...
Many thanks