Apple's location services use a third-party database of wifi base station hardware addresses. That is, companies drive around neighborhoods sniffing wireless networks, saving the approximate GPS coordinates of those signals. Works very well all things considered.