In order for Kepler to determine the orbit of Mars, he had to first reconcile the orbit of the earth. He used some observational data of the Mars and the sun to make triangulations to find the orbit of the earth. He could not calculate the actual distance to the sun, but he could find the relative positions.
In order to triangulate your position in space, you need to see at least two fixed objects, for which you know the position. This is easy to visualize if you imagine that you are in a boat trying to find your position on some charts and there are two lighthouses that you can see off in the distance. The lighthouses are marked on your charts. All you need to do is take some compass readings of the two lighthouses. Let's say that you see Lighthouse A at 30 west of north, and you see Lighthouse B at 20 north of east. To find your position, you would mark those angles on your chart and draw lines backwards. You would be at the intersection of those two lines. (This is shown in the diagram above.)
Plotting the orbit of the earth is done the same way. One fixed object is the Sun, but everything else in the solar system is moving so there is no second fixed object. Kepler was able to get around this by using the planet Mars, and by being very careful about the data he used. He knew that it takes Mars 687 days to go around the sun exactly one time. This means that every 687 days, Mars is in the same place. If we take readings of the Sun and Mars over a long series of observations, each 687 days from the previous, we can triangulate the earthÕs position from these "fixed" points. It turns out that we need about 20 years of consecutive data to really make this work. (Luckily for Kepler, he had 20 years of very accurate data from Brahe.)
Unlike the boat example, we do not have a big chart with the positions of the Sun and Mars already marked. If we wait until Mars is in opposition, then Mars and the Sun are 180 apart; the earth is in between the Sun and Mars. While we cannot use this to find the earth on this date, we can use it to set up our "chart" for plotting the orbit of the earth.
Let's imagine that on a particular date, Mars is in opposition with the Sun. Let's also say that Mars is at 9 and the Sun is at 189. These measurements are longitudinal degrees along the ecliptic. Because these angles are 180 apart, they cannot be used for a triangulation, but it will let us set an orientation for Mars and the Sun. This is shown in the diagram below.
First, we would draw a dot to represent the Sun. Then we would draw a line that is rotated 9 counter clockwise. We then pick an arbitrary point along that line to be Mars. The earth is somewhere along that line, but we cannot tell where along that line. We will now use these as the "fixed" positions of the Sun and Mars. After this, we would need some data that is exactly 687 days later, because that is how long it will take Mars to get back to the same place. However, the earth will be in a different place in its orbit, and so it will appear from the earth that Mars and the Sun have moved. Let's say that Mars appears at a position of 56 along the ecliptic, and that the Sun appears at 146 along the ecliptic. To use this data, we go to Mars and the Sun, measure those angles, and then draw lines backwards. Where the two lines cross is where the earth has to be. We would repeat this process, waiting another 687 days before taking the measurements. After about 20 years of data, we will have plotted several positions of the earth going all the way around its orbit.
It is important to note that we cannot determine how far away the earth is from the Sun in this method. All we can do is make measurements calling the average distance between the Sun and the earth 1, which is what we call an Astronomical Unit (AU).