The difference between the beach and a public thoroughfare is in Bava Basra 57b:
ועוצם עיניו מראות ברע א"ר חייא בר אבא זה שאין מסתכל בנשים בשעה שעומדות על הכביסה היכי דמי אי דאיכא דרכא אחריתא רשע הוא אי דליכא דרכא אחריתא אנוס הוא לעולם דליכא דרכא אחריתא ואפ"ה מיבעי ליה למינס נפשיה
"He closes his eyes from seeing evil" (Isaiah 33:15). R' Chiya Bar Abba says this means someone who doesn't look at women while they're standing over the laundry (where parts of their bodies are exposed). How is this? If there's another road (and he doesn't take it), he is wicked. If there is no other road, he is forced (to see them)? Really it's where there's no other road, but still he is supposed to force himself. (And Rashbam adds that this is what the verse means: someone who does that is a pious person (chassid).
So in short, when walking down the street there's less of a choice: another street isn't necessarily going to have people dressed any better. Ideally you should avert your eyes, but you can't be called wicked for not doing that. But going to where the ladies are doing laundry (or are in bathing suits) when you could have avoided going there - is what the Gemara is calling wicked.