I need to pee so I'm just gonna go right in the middle of the public sidewalk.
I hope you are joking. Don't you think peeing on public property is an offensive thing to do?
My doctor told me that I should pee when I feel the need to do so.
I really doubt your doctor told you to urinate on public property if you need to go. If your doctor told you not to hold your urine, then you still need to find a proper place to go to the bathroom. Look for a restroom to use, or purchase adult diapers to wear. Urinating in public is gross and will bother other people who walk in the area.
I don't want to wear a diaper. This is a last resort. I'm doing it because I have to.
Before resorting to peeing on the sidewalk, look for a restroom. I'm sure there is a bathroom nearby or a store that you could ask to use the restroom in. If there are actually no other options, at least go in a bush or somewhere that people aren't likely to walk through.