Question

Converting MULTILINE STRING to geometry

  • 18 November 2018
  • 9 replies
  • 44 views

Badge

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

Badge

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.

Badge

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'??

Badge

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.

Userlevel 4
Badge +30

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

Badge

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

Badge +7

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.

Userlevel 1
Badge +21

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

Badge +7

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.

Badge +7

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.

Reply