What is the best way to add point to existing LINESTRING in codeless?

Hello Ez,

you can use the Update GEO LineString block for this purpose

Hi Stan,

That block updates the whole LineString. Is there a way to add just one point to the end of array in LineString?

Hi Ez,

I do not see a codeless block to do what youโ€™re asking for. Would you be interested in a solution that uses code? (it can be embedded into codeless logic)


1 Like

Hi Mark,

That what I thought. It would be great to have example.

In my case it looks like this: I receive LAT and LON then I need to add that point to existing GEO LineString.
I tried to compose list of points from existing LineString then add point but I couldnโ€™t extract points from LineString. Even If there is way to extract points from LineString then structure becomes bulky. Solution with code then embed to codeless logic sounds better.

Is your existing LineString stored in some codeless variable?

I pull it from DB and yes I can store it in variable.

Hereโ€™s an example:

The Custom Code block has the following logic:

var linestringPoints = linestring.getPoints();
linestringPoints.push( point );
linestring.setPoints( linestringPoints )

UI Builder - ConsoleDemo - Backendless ๐Ÿ”Š 2022-08-30 14-32-46

Hereโ€™s the output of the program:
index.html?page=linestring ๐Ÿ”Š 2022-08-30 14-33-19


1 Like

Awesome! Thank you, Mark!