Skip to main content
Question

Transformation from (.csv) into (.pxy) or (.txt)

  • May 6, 2020
  • 7 replies
  • 409 views

Hi,

I kindly need to know how to transform a file in .csv format into a file in .pxy format or a .txt format.

 

Many thanks,

Mamdouh

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • May 6, 2020

If you simply want a basic A-to-B conversion from CSV to TXT the Generate Workspace option would probably be fine.

I'm not familiar with the .pxy format and can't seem to find it in FME's list of supported formats, can you tell us a bit more about it?


  • Author
  • 6 replies
  • May 6, 2020

If you simply want a basic A-to-B conversion from CSV to TXT the Generate Workspace option would probably be fine.

I'm not familiar with the .pxy format and can't seem to find it in FME's list of supported formats, can you tell us a bit more about it?

Thanks. In fact I tried the Generate Workspace, but the generated text file I get is empty for some reason, so I wonder why.

 

The Pxy file is in principle a text file, usually imported from certain programs and include coordinates. But does not really matter if you can thankfully answer me about the txt format.


Forum|alt.badge.img+2
  • 1891 replies
  • May 6, 2020

@mamdouh_90 Could you attach a small example of the source data and what you'd like to see in the destination data? CSV and TXT are both plain text ASCII datasets. The CSV reader splits the records into attributes. The txt writer writes a single attribute (text_line_data) as a record.


  • Author
  • 6 replies
  • May 7, 2020

@mamdouh_90 Could you attach a small example of the source data and what you'd like to see in the destination data? CSV and TXT are both plain text ASCII datasets. The CSV reader splits the records into attributes. The txt writer writes a single attribute (text_line_data) as a record.

Hi,

The source data is, let's say a coodinate list in an excel sheet in csv format as seen in the attached image (1). The format I would like to get is text format as shown in attached image (2).

Image 1

 

Image 2


Forum|alt.badge.img+2
  • 1891 replies
  • May 7, 2020

@mamdouh_90 Thanks for including the examples. FME doesn't have a Column Aligned Text writer. But you can probably combine the FME String functions @Format() & @PadLeft() to give you the formats you need. Then concatenate the resulting strings together and send those to the Text Line writer. A bit tedious, but doable if you don't have too many attributes.

The workspace would look something like this;

Workspace example (FME 2020): columnalignedtext.fmwt


  • Author
  • 6 replies
  • May 12, 2020

@mamdouh_90 Thanks for including the examples. FME doesn't have a Column Aligned Text writer. But you can probably combine the FME String functions @Format() & @PadLeft() to give you the formats you need. Then concatenate the resulting strings together and send those to the Text Line writer. A bit tedious, but doable if you don't have too many attributes.

The workspace would look something like this;

Workspace example (FME 2020): columnalignedtext.fmwt

Many thanks for the answer. In fact I did not get how to select the format, what does %.6f stand for?


Forum|alt.badge.img+2
  • 1891 replies
  • May 12, 2020

Many thanks for the answer. In fact I did not get how to select the format, what does %.6f stand for?

string format options are described here http://docs.safe.com/fme/2020.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/stringformatter.htm?Highlight=stringformatter or in more detail https://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tcl/format.n.html