Question

change coordinate format DM -> DD

  • 25 April 2024
  • 1 reply
  • 21 views

Badge +7

Hello, 

I'm sure it's a pretty simple question, but somehow I can't see the wood for the trees to find the answer.

I have a list (.xls) of coordinates in the form <name>, <x_coord>, <y_coord>. The coordinates are, for example, in the form N 51° 06.796 E 3° 14.545.

Now I want to save the information in an FGDB and would have expected the VertexCreator to help me with this. Unfortunately, all my values are completely rejected. My further attempts - removing all spaces; using the HUB Transformer "DegreeFormatter" or Decimal Degrees Calculator all failed. For this reason, how do I manage to get the coordinate format into a form so that the VertexCreator accepts it? Thank you very much.


1 reply

Userlevel 4
Badge +26

So the required format and inputs for the DegreeFormatter are as follows
 

DD°MM.MMM’ (E|W|S|N)

So your x (long) would be  3°14.545’ E
and the y (lat) would be 51°06.796’ N

Combined it should be:

51°06.796' N, 3°14.545'E


I’m not sure at the fastest way to do this but I would probably try the following

Extract the direction from coordinates using a couple of SubstringExtractors (just get index 0). save these as an attribute called “_direction_x” and “_direction_y” or something

then use a StringReplacer to remove all the <space> charachters and letters - regex = [a-zA-Z]|\s 

Then after that you can use an AttributeCreator/manager to make new combined x, y values which you can feed into the DegreeFormatter.
 

@Value(y)' @Value(_dicrection_y), @Value(x)'@Value(_dicrection_x)

This should give you an attribute with the value 51°06.796' N, 3°14.545'E which you can feed into the DregeeFormatter.

 

Reply