Skip to main content

Hello,

I have a set of features, composed of polylines with 50 points each. With each point, i would like to keep an argument in the form of a list, so that each line has a list of argument from the points. The list is created using the PythonCaller:

listdistances=[str(distance[0])]

for i in range (1,n-1):

      intermediaire=0

      disabs=float(distanceo0])+i*pas

      listdistances.append(str(disabs))

      while float(distanceÂintermediaire]) <= disabs :

        intermediaire += 1

listdistances.append(str(distancei-1]))

newFeature.setAttribute('listedistance{}',listdistances)

 

So it is clear that the list is full of str format. The list is made and kept for all the next transformers and works with them. But it is not kept once it goes through a writer. When I open it on the data inspector afterwards, the 55 attributes go down to 5, as the 50 in the form of a list disapear.

I tried to use a list concatenator, but the maximum size is too small for my list data, which can easily go over 1000 characters:

Shapefile writer: Cannot support attribute 'listedista' with width of '500'; maximum attribute length in dBASE is 254 except for 'memo' type. Attribute will be set to width of 254 and values truncated if necessary

 

Any idea on how to fix the problem ? This data is important, but I can not just take this program into the bigger one, it is too much to handle for the PC.

If the explainations seems lacking, please tell me so I will try m best to clarify it.

Thanks in advance

You can only write list items to a format that supports them, which shape files do not. You will need to restructure your data if it's important to retain this information.


You could generate a UUID for each feature, then write out the non list attributes to SHP (including the UUID). Alongside this, explode out the list only retaining the UUID and list attributes. Then write these out to a no geometry SHP. You can then do a one-to-many relationship with the spatial SHP and the no geom SHP


Reply