Hi
Does anyone have a transformer or groups of transformers prebuilt to extract this 32°25'20.4"S 151°29'40.5"E 2145.1 to decimal degrees split into degrees minutes decimal seconds
Â
yes i am lazy.....but pressed for time
Hi
Does anyone have a transformer or groups of transformers prebuilt to extract this 32°25'20.4"S 151°29'40.5"E 2145.1 to decimal degrees split into degrees minutes decimal seconds
Â
yes i am lazy.....but pressed for time
You can use a StringSearcher with the following regex to split the values:
(\d+\.?\d*)|(\NSEW])
You'll have to set the "All matches list name" to something like _parts, which will be a list that will contain all the separate elements of your DMS string, e.g.:
`_parts{0}.match' has value `32'
`_parts{1}.match' has value `25'
`_parts{2}.match' has value `20.4'
`_parts{3}.match' has value `S'
`_parts{4}.match' has value `151'
`_parts{5}.match' has value `29'
`_parts{6}.match' has value `40.5'
`_parts{7}.match' has value `E'
`_parts{8}.match' has value `2145.1'
You can then feed the individual numbers into a DecimalDegreesCalculator, e.g.:
You may also want to use something like a TestFilter and a couple of ExpressionEvaluators for values that aren't situated in the north-eastern hemisphere.
I notice in the DecimalDegreesCalculator help it suggests:
...if the attribute has the format:
-DDDMMSS.SS°
the following regular expression could be used in the StringSearcher to parse it into a list attribute with three elements:
^(-??0-9]+)((0-9]]0-9])((0-9]]0-9]].]]0-9]*)
Obviously you'd need to clean up your string a little first, removing some excess characters.
You can use a StringSearcher with the following regex to split the values:
(\d+\.?\d*)|(\NSEW])
You'll have to set the "All matches list name" to something like _parts, which will be a list that will contain all the separate elements of your DMS string, e.g.:
`_parts{0}.match' has value `32'
`_parts{1}.match' has value `25'
`_parts{2}.match' has value `20.4'
`_parts{3}.match' has value `S'
`_parts{4}.match' has value `151'
`_parts{5}.match' has value `29'
`_parts{6}.match' has value `40.5'
`_parts{7}.match' has value `E'
`_parts{8}.match' has value `2145.1'
You can then feed the individual numbers into a DecimalDegreesCalculator, e.g.:
You may also want to use something like a TestFilter and a couple of ExpressionEvaluators for values that aren't situated in the north-eastern hemisphere.
Â
That award is well deserved...thankyou superstar !!!You can use a StringSearcher with the following regex to split the values:
(\d+\.?\d*)|(\NSEW])
You'll have to set the "All matches list name" to something like _parts, which will be a list that will contain all the separate elements of your DMS string, e.g.:
`_parts{0}.match' has value `32'
`_parts{1}.match' has value `25'
`_parts{2}.match' has value `20.4'
`_parts{3}.match' has value `S'
`_parts{4}.match' has value `151'
`_parts{5}.match' has value `29'
`_parts{6}.match' has value `40.5'
`_parts{7}.match' has value `E'
`_parts{8}.match' has value `2145.1'
You can then feed the individual numbers into a DecimalDegreesCalculator, e.g.:
You may also want to use something like a TestFilter and a couple of ExpressionEvaluators for values that aren't situated in the north-eastern hemisphere.
Â
Â
Â
FYI: It's probably way too late now, but I just uploaded the DegreeFormatter to the FME Hub.
With this custom transformer, it should be easy to deal with these kind of problems. Handles multiple attributes at once and is able to work with latitude, longitude or latitude-longitude coordinates without having to use regular expressions (although it does use them under the hood ;)).
Â
Can convert DMS, DDM (degrees and decimal minutes), ISO-6709 and DD. And vice versa.Â
Enjoy!You can use a StringSearcher with the following regex to split the values:
(\d+\.?\d*)|(\NSEW])
You'll have to set the "All matches list name" to something like _parts, which will be a list that will contain all the separate elements of your DMS string, e.g.:
`_parts{0}.match' has value `32'
`_parts{1}.match' has value `25'
`_parts{2}.match' has value `20.4'
`_parts{3}.match' has value `S'
`_parts{4}.match' has value `151'
`_parts{5}.match' has value `29'
`_parts{6}.match' has value `40.5'
`_parts{7}.match' has value `E'
`_parts{8}.match' has value `2145.1'
You can then feed the individual numbers into a DecimalDegreesCalculator, e.g.:
You may also want to use something like a TestFilter and a couple of ExpressionEvaluators for values that aren't situated in the north-eastern hemisphere.
This tool was exactly what I needed. However, we did find one problem and that is with FME versions. I use FME 2017 locally but our server currently has 2015. While the upgrade cycle is planned, we want to use this in 2015 as well but there appears to be differences in the regex engine. Any help on what needs to be changed for 2015?
This tool was exactly what I needed. However, we did find one problem and that is with FME versions. I use FME 2017 locally but our server currently has 2015. While the upgrade cycle is planned, we want to use this in 2015 as well but there appears to be differences in the regex engine. Any help on what needs to be changed for 2015?
You have to specify every part which you need to extract by round brackets in FME 2015. For example, this regular expression might help you.
(\d+)\D(\d+)\D(\d+\.?\d*)\D( NS])\s*(\d+)\D(\d+)\D(\d+\.?\d*)\D(eEW])\s*(\d+\.?\d*)
FYI: It's probably way too late now, but I just uploaded the DegreeFormatter to the FME Hub.
With this custom transformer, it should be easy to deal with these kind of problems. Handles multiple attributes at once and is able to work with latitude, longitude or latitude-longitude coordinates without having to use regular expressions (although it does use them under the hood ;)).
Â
Can convert DMS, DDM (degrees and decimal minutes), ISO-6709 and DD. And vice versa.Â
Enjoy!I really like your DegreeFormatter!
I really like your DegreeFormatter!
Thanks!