Question

Creating Polyline from Point data.

  • 18 February 2019
  • 6 replies
  • 44 views

Hi All,

I am having the point data in which has X, Y for each point and trying to convert this to a polyline. but somehow I am not getting desired results. This point is derived from JSON query it has X, Y and one common field I am trying to use vertex cretor and then sorter on the common field and at the end, i am using LIne builder. but i am not getting desired results.

Can someone please suggest a way to resolve this?

Thank you in advance .

 

 

 


6 replies

Userlevel 5
Badge +25

VertexCreator and LineBuilder is the way to go but it does require that the points are in order before connecting them. Do you have an attribute that indicate the order of the points within each line? If so, sort on the "common" attribute and then the order attribute, using a Sorter, before trying to connect them.

VertexCreator and LineBuilder is the way to go but it does require that the points are in order before connecting them. Do you have an attribute that indicate the order of the points within each line? If so, sort on the "common" attribute and then the order attribute, using a Sorter, before trying to connect them.

hi, @redgeographics there is no order for a point. however, I am using sorter before line builder. Sorter is used on longitude field and Transaction_ID still I don't get desired results.

Userlevel 6
Badge +32

If this is related to this question I think the approach should be different.

In the full block of json you posted is a piece where the creation of a linesegment is described:

..., {            "type": "CreateGeometry",            "featureType": "ccom:4_0:ccom-Core:RoadElement",            "geometry": {                "type": "LineString",                "coordinates": [                    [-412716042, -217824135],                    [-412710157, -217826553]                ]            },...

I suspect that all these pieces describe segments. Once you have the segments you might be able to connect those using a LineCombiner.

Added a workspace to break down a single part.

jsontoline.fmwt

If this is related to this question I think the approach should be different.

In the full block of json you posted is a piece where the creation of a linesegment is described:

..., {            "type": "CreateGeometry",            "featureType": "ccom:4_0:ccom-Core:RoadElement",            "geometry": {                "type": "LineString",                "coordinates": [                    [-412716042, -217824135],                    [-412710157, -217826553]                ]            },...

I suspect that all these pieces describe segments. Once you have the segments you might be able to connect those using a LineCombiner.

Added a workspace to break down a single part.

jsontoline.fmwt

Thank you @nielsgerrits i will try the workspace you shared.

   Indeed this is related to the other question which I posted earlier .. so from JSON i am getting the coordinate information for each line segments. one transaction id is linked to one line so all the coordinates are vertices of one line segment in this json code block.

 

Userlevel 5
Badge +25

hi, @redgeographics there is no order for a point. however, I am using sorter before line builder. Sorter is used on longitude field and Transaction_ID still I don't get desired results.

Looks like @nielsgerrits has already come up with a solution but I do want to add that in general you shouldn't sort on longitude or latitude unless the features run consistently E-W or N-S

VertexCreator and LineBuilder is the way to go but it does require that the points are in order before connecting them. Do you have an attribute that indicate the order of the points within each line? If so, sort on the "common" attribute and then the order attribute, using a Sorter, before trying to connect them.

@redgeographicsI agree with you. as results are not consistent i am trying with different fields.

I am still testing with wb which @nielsgerrits has shared earlier.

Reply