Little parenthesis: I map mostly in the metropolitan area of Porto Alegre. In 2013, I attempted to classify the city using the official physical profiles of streets. That led to a large number of tertiary roads (corresponding to the physical profile of urban collector ways). Looking at the resulting high density of tertiaries, the Brazilian community rejected this idea and recommended staying closer to the city plan. So I did. Here is a map of the official road hierarchy. You can compare that with the one in OSM, which has been accepted for years now. They match closely, but not quite. The differences are mainly due to arterial roads that have not been fully built.
The collector system, not published officially, is inferred from a variety of features on the ground (signage, traffic lights, street width and right of way), controlled for planning aspects (such as density), and was done as a proposal (so far, no complaints, so it stays). So, in this particular city without an official collector system, tertiaries only mean important roads and nothing else.
That cannot be said of the neighbour town of Canoas, which does have a well-defined system of collectors.
In Porto Alegre, the only reliable way one can assign the maxspeed=* tag to any non-arterial way without signage is by comparing the physical profile of the road with the official physical profiles. So, many residential ways end up with maxspeed=40. In some situations, thanks to road signage, collectors end up with maxspeed=30. It is messy, but the best that can be done with official data. The only alternative would be to assume that the absence of collectors means that any non-arterial way is local and therefore maxspeed=30. That is ok, but most would prefer to be taken through the slightly wider residential ways, that are faster. As if this weren’t enough, most residential ways have a speed sign somewhere along their path, usually old and difficult to see, usually confirming that their speed limit is indeed that predicted from the physical profile. As the sign is not very visible, few people know the actual speed limit, and driving above the speed is common.
In the neighbour city of Canoas, however, the official map can be used to assign maxspeed, regardless of physical characteristics, except in really extreme conditions (such as narrow paths through slums that the municipality wants to, one day, turn into fully functioning standard local ways).
Then, of course, we have a problem finding every city plan. We have around 150 so far (most collected and put on the wiki by me), and Brazil has over 5k municipalities. Surely it is easier to guess road hierarchy on small cities, but nonetheless this is quite a problem for us.
It was very fun here to watch Waze assign speed limits to residential ways when they enabled that feature. Some residential ways still incorrectly have a speed limit of 70 km/h on Waze (!), whereas others that I often pass had a varying limit depending on the day, probably because wazers were discussing what the actual limit should be. The fewer wazers in an area, the slower this process seemed to unravel.