Skip to main content
Question

Converting MULTILINE STRING to geometry

  • November 18, 2018
  • 9 replies
  • 257 views

thomastupuivao
Contributor
Forum|alt.badge.img+6

I'm trying to convert a CSV file of MULTILINE STRINGS for 'road centerlines' to Geometry. I've been able to do so for the 'address points' using "stringsearcher + vertex creator" but am struggling with the 'roads' as there are multiple pairings of coordinates;

MULTILINESTRING ((-41.2762718167 173.2862863, -41.2762702333 173.2867388167, -41.2762720167 173.28681425))

9 replies

Forum|alt.badge.img

Have you tried converting the text to geometry using the GeometryReplacer? It can convert the text to geometry. Choose geometry encoding OGC Well Known Text.


thomastupuivao
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • November 19, 2018

Do I need to use regex on the value when choosing the "geometry source", as it doesn't seem to create geometry when I use 'GeometryReplacer'??


Forum|alt.badge.img
thomastupuivao wrote:

Do I need to use regex on the value when choosing the "geometry source", as it doesn't seem to create geometry when I use 'GeometryReplacer'??

The entire text line you posted should enter the GeometryReplacer. Including the word MULTILINESTRING and the brackets. No regex is needed.


danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • November 19, 2018
thomastupuivao wrote:

Do I need to use regex on the value when choosing the "geometry source", as it doesn't seem to create geometry when I use 'GeometryReplacer'??

Hi @thomastupuivao

I agree with @bartjannink about the suggestion to use the transformer GeometryReplacer and your case.

 

Thanks,

Danilo


thomastupuivao
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • November 19, 2018

Okay, figured out from a different topic that by stripping the 'MULTI' as well as the double brackets, GeometryReplacer works!! Thanks again!!


scarter
Contributor
Forum|alt.badge.img+9
  • Contributor
  • February 24, 2023

Hi @thomastupuivao​ . I'm trying to do something similar., I have a csv of records each with a multlinestring value (e.g.: MULTILINESTRING ((-0.07391196 51.50043684, -0.07422012 51.50052063, -0.07426638 51.50053251, -0.0747972 51.500457, -0.07556634 51.50019987, -0.0758331 51.50015361)) ). Is it as straightforward as this...

Creator>

Feature Reader (reading the csv)>

GeometryReplacer (using encoding OGC Well Known Text and picking the field containing the multilinestring value.)>

FeatureWriter (to shp etc.)

 

I'm trying the above but not getting the output required. Maybe it needs a vertexcreator and coord system setter. Any tips are very welcome. Thanks.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 24, 2023
scarter wrote:

Hi @thomastupuivao​ . I'm trying to do something similar., I have a csv of records each with a multlinestring value (e.g.: MULTILINESTRING ((-0.07391196 51.50043684, -0.07422012 51.50052063, -0.07426638 51.50053251, -0.0747972 51.500457, -0.07556634 51.50019987, -0.0758331 51.50015361)) ). Is it as straightforward as this...

Creator>

Feature Reader (reading the csv)>

GeometryReplacer (using encoding OGC Well Known Text and picking the field containing the multilinestring value.)>

FeatureWriter (to shp etc.)

 

I'm trying the above but not getting the output required. Maybe it needs a vertexcreator and coord system setter. Any tips are very welcome. Thanks.

It should just be as simple as using the GeometryReplacer on the text value. What are the issues you are encountering? The string you posted in your example gets created as a line with that workflow with no issue

image


scarter
Contributor
Forum|alt.badge.img+9
  • Contributor
  • February 24, 2023
ebygomm wrote:

It should just be as simple as using the GeometryReplacer on the text value. What are the issues you are encountering? The string you posted in your example gets created as a line with that workflow with no issue

image

Thanks for , @ebygomm​ . The problem I'm having is that no geometry lines are being created. In my example I had previously stripped out the MULTILINESTRING text and the double brackets (following a suggestion earlier in the thread). Perhaps I should try it with the MULTILINESTRING text and the double brackets still in place. I'll try that now.


scarter
Contributor
Forum|alt.badge.img+9
  • Contributor
  • February 24, 2023
ebygomm wrote:

It should just be as simple as using the GeometryReplacer on the text value. What are the issues you are encountering? The string you posted in your example gets created as a line with that workflow with no issue

image

Hi. It worked with the MULTILINESTRING text and the double brackets back in place. I now need to convert to british national grid epsg:27700.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings