THANKS.
Best answer by takashi
View originalTHANKS.
Best answer by takashi
View original
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)
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.