the axis on your image (football field) starts about 12 on your x axis, and the axis on your football field is smaller than the x axis, so we need to come up with a calculation that does something similar to y=mx+b. (but not exactly)
y=the visual yards on the field
m= the multiplier
x= the "Yard Line" Parameter
b=12 (since the football field axis starts about 12 on the x axis)
It gets a little more complicated since a football field goes up to 50 yards and then goes back down. To make this work, we need to use 2 parameters, one to choose the side of field we want to calculate, and the other to choose the Yard Line. I've attached a workbook that works on my end, but depending on the resolution and dimensions of your screen, it may only come close.
1) create a parameter to choose Yard Line
2) create a Parameter to choose the Side of Field
3) create a Calculation that uses the 2 Parameters. The Calculation will look somthing like I have below. The 0.75 is to account for 'm' in equations
if [Side of Field] = 'Left'
then [Yard Line]*0.75+12
elseif [Side of Field]= 'Right'
then ([Yard Line]+(50-[Yard Line])*2)*0.75+12
Background_Image_Example.twbx.zip 258.1 KB
So I took a different track:
I used ImageJ to dump out the greyscale values from the image into a CSV. If you need the colors back just reverse the formulae.
Output: see attached. I know there is a gif to tableau converter on github if you get stuck.
American-football-field.txt.zip 114.1 KB
Thanks for the responses. I actually have the data plotted 0-100, so the opposing 20 yard line would be marked as x=80 so don't have to manage for sides of field, but like what you did to control for that.
@Allan, thats really awesome how you were able to create the field, I need to learn more about how you did that. I think my issue now is that the football field isn't evenly spaced along the x axis. If you look at the new attached workbook, you can see that the 20 yard line matches pretty close to the avg x axis of 20, but gets offline around the 40 yard line, so the rest of the markings are a little off. Is there a way to make the yard markings match the avg x axis marks exactly? If so, I think the viz would work perfectly.
Background_Image_Examplev2.twbx.zip 431.5 KB
Thanks for that - I didn't have time to put an x,y column in like the Image Magick script does on Github. But it's just a case of 0 to 366 (i.e. pixel corner to corner). I'm certainly not going to take any credit for plagiarizing an idea or the code...I just thought it was a neat way to get the image data. I just exported using ImageJ.
The other option is to use a AutoCad DWG and then convert to a SHP file, I don't have AutoCad on my machine - and simply don't have the time right now, but that would give you pixel perfect regulation pitch dimensions. I'm sure there are many other ways of skinning this cat.