Solved

ASCII point and line .xyz export to DEMGenerator

  • 17 January 2013
  • 1 reply
  • 20 views

Hey Geos,  Has anyone built a workbench the reads in ASCII point and line file and generates either the RasterDEMGenerator or DEMGenerator?  The ASCII breakline contains 4 fields (X, Y, Z, start/stop[1]).  The breakline has a 1 at the start of the breakline then 0 for each vertice, then a 1 for the end of the breakline.  I am unable to figure out how to have the transformer reads the breakline.xyz file.  This breaklines are seperate from the ASCII point files.  Looking for some help with this head scratcher. 

 

THANKS.
icon

Best answer by takashi 18 January 2013, 08:00

View original

1 reply

Userlevel 3
Badge +17
Hi,

 

 

Creating line geometries from a series of coordinate values is realized by using 2D/3DPointReplacer and PointConnector, I think it's a general way on FME. In your case, I suppose the point would be how to append a new attribute which indicates Line ID to each coordinate feature (vertex). If each vertex has Line ID, you can create separate lines by setting the attribute name to "Connection Break Attribute" parameter of PiontConnector.

 

  Several transformers - Counter, Testers, VariableSetters, VariableRetrievers - occurred in my head, but assembling them might be a little complicated, and it's very difficult to explain it with my poor English skill... (:-( So, I'd provide you a sample script which can be used with PythonCaller instead of those transformers:   import fmeobjects   # global variables isStartVertex = True lineId = -1   # assumes 'flag' is the name of start/stop attribute. # flag = 1: start or stop vertex # flag = 0: intermediate vertex def setLineId(feature):     global isStartVertex, lineId     if int(feature.getAttribute('flag')) == 1:         if isStartVertex:             lineId = lineId + 1             isStartVertex = False # next 'flag = 1' vertex is not start (is stop)         else:             isStartVertex = True # next 'flag = 1' vertex is start     feature.setAttribute('_line_id', lineId)  

Reply