Jump to content

Calling all clever people


Recommended Posts

Posted

Not really geocaching related but something that overlaps for me, I have a list of waypoints in csv format and need to load to MM and they change on a regular basis, being a lazy git I would like to be able to convert into an importable format, any ideas?

the list is formatted as:

52°58'.640,0°21'.080,R.MIDDLE,LFL10s

52°56'.000,0°20'.000,SealSand,Q

52°56'.290,0°23'.400,Sunk,Q(9)15s

52°55'.000,0°24'.000,No.2,FL(2)R6s

52°55'.000,0°23'.500,No.3,FL(2)G6s

52°54'.000,0°23'.325,No.4,FLR5s

52°54'.250,0°23'.275,No.5,Q(3)10s

52°53'.632,0°22'.702,BulldogTideBcn,QG

52°53'.035,0°22'.680,No.6,FLR3s

52°52'.995,0°22'.465,No.7,FLG5s

52°52'.282,0°22'.400,No.8,FL(2)R6s

52°52'.077,0°22'.275,No.9,Fl(2)G6s

52°51'.885,0°23'.310,No.10,FLR5s

52°51'.970,0°22'.200,No.11,FLG3s

52°51'.745,0°22'.040,No.12,FL(2)R4s

52°51'.775,0°21'.945,No.13,FLG5s

52°51'.370,0°21'.930,No.14,FLR.3s

52°51'.535,0°21'.850,No.15,QG

52°50'.960,0°21'.750,No.16,FL(3)R10s

52°51'.190,0°21'.700,No.17,VQ(3)G5s

52°50'.680,0°21'.445,"S",FlG2s

52°50'.552,0°21'.560,No.20,Fl(2)R4s

52°50'.445,0°21'.432,No.21,Fl(2)G4s

52°50'.080,0°21'.590,No.22,QR

52°49'.645,0°21'.460,No.23,FLG3s

52°49'.729,0°21'.584,Bcn.Z,FL(4)R10s

52°49'.697,0°21'.131,W.StonesBcn,Q

52°49'.390,0°21'.133,Bcn.A,FLY3s

52°49'.400,0°21'.490,No.24,FLR2s

52°49'.090,0°21'.136,Bcn.B,FLY2s

52°48'.759,0°21'.138,Bcn.C,FL(3)Y10s

52°48'.659,0°21'.157,No.25,FLG4s

52°48'.625,0°21'.284,No.26,FL(2)R6s

52°48'.520,0°21'.184,Bcn.D,YBcn

52°48'.148,0°21'.474,Bcn.E,FlY3s

52°48'.095,0°21'.705,EastStonesBcn,FLR2.5s

52°47'.712,0°21'.873,No.27,FLG3s

52°47'.726,0°21'.960,No.28,FLR3s

Posted

Not really geocaching related but something that overlaps for me, I have a list of waypoints in csv format and need to load to MM and they change on a regular basis, being a lazy git I would like to be able to convert into an importable format, any ideas?

the list is formatted as:

52°58'.640,0°21'.080,R.MIDDLE,LFL10s

52°56'.000,0°20'.000,SealSand,Q

52°56'.290,0°23'.400,Sunk,Q(9)15s

52°55'.000,0°24'.000,No.2,FL(2)R6s

52°55'.000,0°23'.500,No.3,FL(2)G6s

52°54'.000,0°23'.325,No.4,FLR5s

52°54'.250,0°23'.275,No.5,Q(3)10s

52°53'.632,0°22'.702,BulldogTideBcn,QG

52°53'.035,0°22'.680,No.6,FLR3s

52°52'.995,0°22'.465,No.7,FLG5s

52°52'.282,0°22'.400,No.8,FL(2)R6s

52°52'.077,0°22'.275,No.9,Fl(2)G6s

52°51'.885,0°23'.310,No.10,FLR5s

52°51'.970,0°22'.200,No.11,FLG3s

52°51'.745,0°22'.040,No.12,FL(2)R4s

52°51'.775,0°21'.945,No.13,FLG5s

52°51'.370,0°21'.930,No.14,FLR.3s

52°51'.535,0°21'.850,No.15,QG

52°50'.960,0°21'.750,No.16,FL(3)R10s

52°51'.190,0°21'.700,No.17,VQ(3)G5s

52°50'.680,0°21'.445,"S",FlG2s

52°50'.552,0°21'.560,No.20,Fl(2)R4s

52°50'.445,0°21'.432,No.21,Fl(2)G4s

52°50'.080,0°21'.590,No.22,QR

52°49'.645,0°21'.460,No.23,FLG3s

52°49'.729,0°21'.584,Bcn.Z,FL(4)R10s

52°49'.697,0°21'.131,W.StonesBcn,Q

52°49'.390,0°21'.133,Bcn.A,FLY3s

52°49'.400,0°21'.490,No.24,FLR2s

52°49'.090,0°21'.136,Bcn.B,FLY2s

52°48'.759,0°21'.138,Bcn.C,FL(3)Y10s

52°48'.659,0°21'.157,No.25,FLG4s

52°48'.625,0°21'.284,No.26,FL(2)R6s

52°48'.520,0°21'.184,Bcn.D,YBcn

52°48'.148,0°21'.474,Bcn.E,FlY3s

52°48'.095,0°21'.705,EastStonesBcn,FLR2.5s

52°47'.712,0°21'.873,No.27,FLG3s

52°47'.726,0°21'.960,No.28,FLR3s

 

Are they a list of lighthouses?

 

I don't understand your problem - csv files can be imported directly into MM

 

You can maintain them in any spreadsheet program - or use GSAK

Posted

I would create a csv export from memory map with just one or two marks. Open this with notepad and take a look at the format. You now need to convert your csv file into this format.

Posted

But I can't get it into MM as the coords are D M.mm and not decimal degrees, they are not lighthouses they are bouy positions for the run in and out of kings lynn in the wash, the bloody things keep moving, if sandbanks were geocaches it wouldn't be allowed and would solve the problem.

Posted

Cut and paste your waypoints into a Notepad file. This basic macro should get them in GSAK and then you should be away.....

 

************************************

 

SET $DataPath="c:\sandbank.txt"

IF (FileExists($DataPath))

SET $CSVfile=GETFILE($DataPath)

IF Left($CSVfile, 7) = "*Error*"

CANCEL Msg="CSVfile"

ENDIF

ENDIF

 

$cnt=1

$CSVline = Replace("'","",Extract($CSVfile, $_Newline,$cnt),true)

 

WHILE NOT($CSVline="")

 

ADDNEW

 

$data=Extract($CSVline,",",1)+" "+Extract($CSVline,",",2)

 

$data = GCalc($data,"FormatDegrees")

 

$d_Latitude=Extract($data,";",1)

$d_Longitude=Extract($data,";",2)

$d_Code="bank"+NumToStr($cnt)

$d_Name=Extract($CSVline,",",3)+" "+Extract($CSVline,",",4)

 

$cnt=$cnt+1

$CSVline = Replace("'","",Extract($CSVfile, $_Newline,$cnt),true)

 

ENDWHILE

Posted

Mmmh, strange. It is a rough piece of code but I can't reproduce any such error. If you could give the full error message and exactly what you have done so far, that would be good.

 

Maybe try starting a new database with no records in it and see if that helps.

 

Also, what version of GSAK are you using? I believe that ADDNEW is a new function for Version 7.

Posted (edited)

Right, this contains a few changes to Rodz' macro, this works in GSAK6 (tested) and instead of importing to a GSAK database, creates the MM csv directly.

 

Change the location of the files in the first two lines.

 

$DataPath="c:\sandbank.txt"
$OutputPath="c:\MM-sandbank.csv"

IF (FileExists($DataPath))
 $CSVfile=GETFILE($DataPath)
 IF Left($CSVfile, 7) = "*Error*"
CANCEL Msg="CSVfile"
 ENDIF
ELSE
 CANCEL Msg="File not found"
ENDIF

$Output = ""
$cnt=1
$CSVline = Replace("'","",Extract($CSVfile, $_Newline,$cnt),true)

WHILE NOT($CSVline="")

 $data=Extract($CSVline,",",1)+";"+Extract($CSVline,",",2)

 $odata = GeoCalc($data,"FormatDegrees")
 # Display error message and abort the macro if an error
 If Left($odata,1) = "*"
Cancel msg=$odata" "$data
 EndIf

 $Code="bank"+NumToStr($cnt)
 $Name=Extract($CSVline,",",3)+" "+Extract($CSVline,",",4)

 $LnOut = "WP04,"+Replace(";", ",", $odata, false)+",0,"+$Code+","+$Name+",,0,1,,1,1,Sandbanks,0"
 $Output = $Output + $LnOut + $_Newline

 $cnt=$cnt+1
 $CSVline = Replace("'","",Extract($CSVfile, $_Newline,$cnt),true)

ENDWHILE

$Data = PutFile($OutputPath,$Output)
IF Left($Data,7) = "*Error*"
 Pause Msg="$Data"
 Cancel
ENDIF

$msg="Done, you should import this file into Memory Map: "+$OutputPath

Return Msg=$msg

Edited by Edgemaster
Posted

Thanks a lot edgemaster that one works well, just got to do some tweaking now to get the icons right but I'm sure I can manage that bit, I'm still on version 6 Rodz so that will be where the problem lies.

Thanks to all for the great effort put in to a non geocaching problem, what great people you are!

Posted

To tweak icons, the first #0 (bolded) in this line can be changed to another number for another icon.

 

$LnOut = "WP04,"+Replace(";", ",", $odata, false)+",0,"+$Code+","+$Name+",,0,1,,1,1,Sandbanks,0"

Posted

I'm trying to get a bit lazier that that, how do I check if a particular variable contains a certain letter? so if the last value of the line contains 'R' the icon value will be 21, if it contains a 'G' it will be 20 and 22 otherwise.

Posted
so if the last value of the line contains 'R' the icon value will be 21, if it contains a 'G' it will be 20 and 22 otherwise.

Would be something like

If Right($variable, 1) = "G"

$icon=21

Else

$icon=20

Endif

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...