Multiple Ring Buffer in ModelBuilder error: could not convert string to float

322
5
Jump to solution
04-09-2020 12:44 AM
Christian_MartinMützel1
New Contributor III

Hi!

I'm currently using ModelBuilder to automate a process on about 400 shapefiles, but I'm having trouble to get it working. First, I create a study area (buffer) and then clip land use area. Then I select the land use classes of interest and calculate 21 radius values which I want to use to run Multiple Ring Buffer (MRB). Below, you can find the model including the error I get when running it. I don't know why it's trying to convert a string to float at all, because all the radius values are stored as Double and in the Get Field Value command I also specified the data type Double. Does anyone know why this occurs and how to fix this error?

Here you can see the attribute table from which Get Field Value draw the radius values (rCircle00, ... rCircle20):

And this are the parameters I set for the MRB (1) before running the model and (2) what it looks like after running the model when I get the error. I'm not sure about the (1) Distances = 1 which was generated when I connected the Collect Value Output to the MRB. However, it seems that the distances were passed correctly, as seen in (2).

MRB Parameters start

Reply
0 Kudos
1 Solution

Accepted Solutions
JoshuaSharp-Heward
Occasional Contributor

Hi,

It looks to me like the issue is with the commas instead of decimal places in the double field - I personally didn't even realise you could have a decimal using a comma in ArcGIS. Regardless of ArcGIS accepting it that way, when it comes to executing the tool in python (multiple ring buffer is a python script tool) something like 123,456 will not be able to be converted to a float (the required input for this tool) due to the comma, as floats in python have a . for decimals. 

View solution in original post

5 Replies
JoshuaSharp-Heward
Occasional Contributor

Hi,

It looks to me like the issue is with the commas instead of decimal places in the double field - I personally didn't even realise you could have a decimal using a comma in ArcGIS. Regardless of ArcGIS accepting it that way, when it comes to executing the tool in python (multiple ring buffer is a python script tool) something like 123,456 will not be able to be converted to a float (the required input for this tool) due to the comma, as floats in python have a . for decimals. 

View solution in original post

Christian_MartinMützel1
New Contributor III

Thanks for your answer! Indeed the solution turned out to be changing decimal separator from comma to dot in my windows settings (originally had European/German format using comma as decimal separator). I wouldn't have come up with that solution by myself because so far I never got any problems with using comma in ArcGIS before.

Christian_MartinMützel1
New Contributor III

With that problem being solved I finished setting up the final model. However, now I have another problem about the red part of the model:

The "Collect Values" command is not being reset after each iteration. Instead, it keeps the values from the first run and on top of those also collects the values of the second run. Therefore, the Multiple Ring Buffer of my first run is correct, but in my second run I end up with something screwed:

Does anyone have an idea how I can fix this problem?

Reply
0 Kudos
DuncanHornby
MVP Frequent Contributor

If you are using an iterator and collecting the results that become a list to feed into another tool then the iterator, the connected tools and the collects tool usually need to be in a sub-model. Read the help file on the topic of sub-models.

Christian_MartinMützel1
New Contributor III

Thank you! I got it fixed by integrating a sub-model now.

Reply
0 Kudos