Hello,
I am wondering if someone might help me with the following:
I have a .GPX file (tracked gps data text file)
The text file is a long list of tracked gps points which are listed like this:
<trkpt lat="55.9202360" lon="-3.2123590">
<ele>104.7</ele>
<time>2014-09-16T14:58:37Z</time>
</trkpt>
I want to be able to put the latitude points in a field purely as a list of numbers
and the same for the longitude points.
I am not concerned about elevation or time.
So in the latitude field it will show:
55.9202360
55.92... (whatever the next point is)
etc for each point
and the same for the longitude field.
I have a field where I can just copy the full gpx file as text and a button to start sorting it.
I think I will be using a repeat to cycle through each line of the next and possibly 'isNumber'
but other than that I am unsure how to go about this - especially because the numbers are decimals and some of them are negative numbers.
Any help is much appreciated!
Extracting numbers from text in a field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Extracting numbers from text in a field
Hi...
put your data into fld 1... the mouseUp will retuen lat/lon separated by a comma
Code: Select all
on mouseUp
repeat for each line thisLine in fld 1
if char 1 to 4 of thisLine = "<trk" then
put thisLine into temp
replace "<trkpt lat=" with empty in temp
replace quote with empty in temp
replace " lon=" with comma in temp
replace ">" with empty in temp
put temp & cr after fld 2
end if
end repeat
end mouseUp
Re: Extracting numbers from text in a field
Thanks for your reply - is there a way of separating the number before the comma and the number after the comma so that the latitude and longitude values are added to separate lists in separate fields?
Re: Extracting numbers from text in a field
Code: Select all
on mouseUp
repeat for each line thisLine in fld 1
if char 1 to 4 of thisLine = "<trk" then
put thisLine into temp
replace "<trkpt lat=" with empty in temp
replace quote with empty in temp
replace " lon=" with comma in temp
replace ">" with empty in temp
put item 1 of temp & cr after fld 2
put item 2 of temp & cr after fld 3
end if
end repeat
end mouseUp