Max. text length for InsertCursor field

1792
16
07-17-2017 12:52 AM
MarcWouters
New Contributor III

I am importing X,Y values from file into a shape, but I need to keep the labels of each point as well in my application.

By lack of a way to keep a list of texts, I create a long string, separated by tabs, to keep the labels and the shape in the same feature in the resulting table.

I use the following code

cursor = arcpy.da.InsertCursor("Pipes", ["Name", "SHAPE@", "PointLabels"])
cursor.insertRow([fileName, polyline, pointLabels])

For some datasets, I get this error

The row contains a bad value. [PointLabels]

I assume that this is caused by exceeding some size limit, but I cannot determine easily which size this could be. (number of points and length of text labels vary quite a lot).

Any idea if there is a limit, and if so, what is this limit ?

0 Kudos
16 Replies
DanPatterson_Retired
MVP Emeritus

if by 'shape' you mean 'shapefile', then the dbf portion of the shapefile limits a text field to 254 characters

http://desktop.arcgis.com/en/arcmap/latest/manage-data/shapefiles/geoprocessing-considerations-for-s...

0 Kudos
MarcWouters
New Contributor III

Hi Dan,

I should have made this more clear (due to my short experience with ArcGIS products, I guess).

It's not a 'shapefile' I'm writing to, but a GeodatabaseFeatureTable, and have had no problems with text strings of 200kB.

After posting the question, I re-ran my script with some extra debug print statements, and I could see that it fails on a polygon with 34573 points, and the string with the labels is 230905 bytes long.

0 Kudos
DanPatterson_Retired
MVP Emeritus
0 Kudos
MarcWouters
New Contributor III

Thanks for pointing out this geodatabase size limits page. Hadn't seen it yet.

Then something else must be wrong.

It's not the content of the text string (backslash or so),it only contains text like 'P1 P2 P3 ... P4357 P4358 ...' and so on

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Marc Wouters  can you elaborate a little more on what you are hoping to gain with a field that contains 'P1 P2 P3 ... P4357 P4358 ...'? If this represents some kind of relation with other features then you might want to consider using relationshipclasses.  

0 Kudos
MarcWouters
New Contributor III

Hi Xander,

In the application (C++/Qt using ArcGIS Runtime 100.0) we're building, we need to be able to identify the label of each individual point of each geometry (pipeline). 

I couldn't find a way to store this in a vector/array/list in the file geodatabase.

Relationshipclasses are new to me, no idea if this can help

0 Kudos
XanderBakker
Esri Esteemed Contributor

Some reading on this topic: Benefits of relationship classes—Help | ArcGIS for Desktop I might be useful in this case. You will be able to have your featureclass and a separate table with the "labels" and the relationship class enables the relation between them. You should revise if relationship classes are supported in ArcGIS Runtime 100.0.

0 Kudos
MarcWouters
New Contributor III

Thanks for the hint, but I guess in my case it is not usefull:

this would become a 'many-to-one' relationship : each line/feature in my pipelines table would need to refer to up to 20k labels, how can I link each X,Y point in the shape field to a label in another table ??

0 Kudos
XanderBakker
Esri Esteemed Contributor

When you have a single line that links to 20k labels it is a 'one-to-many' relationship which is quite common. You also mention that you want to link each X, Y point to a label. Are you referring to the vertices of the line? In that case you should manage those as a separate point featureclass. Still not sure what you are trying to obtain. Can you provide an image that explains what you are trying to achieve?

0 Kudos