Question

Isolate text from .csv column

  • 20 August 2013
  • 4 replies
  • 3 views

Badge
Was wondering if anybody has split text from a .csv column into to seperate columns?

 

 

I have a column named "Coordinates" with x,y data with the word POINTZ before the coordinate.

 

 

Example: POINT Z (-113.807295690 52.269077310 842.30)

 

 

I would like to put just the values in seperate columns (X & Y) containing no text.....

 

 

Once I have the x,y in seperate columns i'm assuming its easy to convert the .csv to a .shp

 

 

Any thoughts

4 replies

Userlevel 2
Badge +17
Hi,

 

 

There are several ways, I would use a StringSearcher with these settings:

 

Attribute: Coordinates

 

Regular Expression: ^.*\\(([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\)$

 

Matched Parts Attribute: _coord

 

 

The StringSearcher adds a list attribute (coord{}) to each feature.

 

If "Coordinates" is "POINT Z (-113.807295690 52.269077310 842.30), for example, the list elements will be:

 

_coord{0} = -113.807295690

 

_coord{1} = 52.269077310

 

_coord{2} = 842.30

 

 

Takashi

 

Userlevel 4
Hi,

 

 

the text looks to be in the WKT format. If so, you could use a GeometryReplacer (with "OGC Well Known Text" as format) to convert the text into a geometry. Then use a CoordinateExtractor to get the individual values.

 

 

David
Badge
Takashi, I don't seem to be able to get this option to run even though it appears straight forward?

 

 

I do not see the list Attributes that the StringSearcher is supposed to create?  _coord{0}

 

 

I'm a little lost when going from the StringSearcher to the GeoMedia SQL Server Warehouse.

 

 

 

 

Badge
Hi Takashi, is their any other way to perform this task, i'm not familiar with this type of coding...

 

 

Also not sure how to implement this code into the the StringSearcher parameters?

 

--Do I use Constant

 

--Do I use multiple StringSearcher Transformers?

 

--Where do you set the _coord{0} . . . ?

 

 

 

Tyler

Reply