Per capita SF might beat NYC (couldn't find good sources and honestly I'm a little tired at the moment) but "Numerically" and "any way you want to slice it" NYC wins hands down. In 2015 it was estimated that San Francisco had 7,539 [1]. NYC, on the other hand, had 60,456 in 2016 [2].
I couldn't find many sources that differed much than these figures I found even though they're about a year separated.
[1] https://sfgov.org/lhcb/sites/default/files/2015%20San%20Fran...
[2] http://www.coalitionforthehomeless.org/basic-facts-about-hom...
New York City is unique in that they have a court mandated obligation to provide accommodation. The advocacy people use a factor of the shelter population to calculate the total population, which may or may not be accurate.
I'm not trying to minimize the problem. The fact is those encampments are all over and people is indicative that functioning people can't get placement in SFO. You can't just say "NYPD are jerks" and call it a day like the previous commenter.
Sf has visible encampments in prime living areas which greatly skews perceptions.
I fell for it to.