Finding the perfect location is unique to you.
Figure out the type of coffee shop you want to have and base the location around that.
Do you want a busy week and quieter weekends?
Find a location in a high business area.
Do you want to appeal to the younger generation?
Maybe a location near a university, college or school.
Do you want to be open into the evening?
A location close to residential areas would help.
Do you want a rural location?
If you are going to be a destination coffee shop, ensure you have adequate parking, cycle stands, or on a public transport route.
Whichever location you choose you need to ensure that there is foot fall and/or easy access. Stake out prospective units and all different times to see how many and what type of people are around, to ensure your idea fits.