Skip to main content
Question

Converting MULTILINE STRING to geometry

  • November 18, 2018
  • 9 replies
  • 320 views

thomastupuivao
Contributor
Forum|alt.badge.img+7

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))
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.

9 replies

Forum|alt.badge.img
  • 11 replies
  • November 18, 2018

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+7
  • Author
  • Contributor
  • 15 replies
  • 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
  • 11 replies
  • 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'??

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


danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • 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'??

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+7
  • Author
  • Contributor
  • 15 replies
  • 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+10
  • Contributor
  • 125 replies
  • 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+44
  • Influencer
  • 3422 replies
  • 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.

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+10
  • Contributor
  • 125 replies
  • February 24, 2023

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+10
  • Contributor
  • 125 replies
  • February 24, 2023

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.