Nearby Users outside the US? December 20, 2005 11:38 PM   Subscribe

Has anyone ever come up with a method or numbering scheme that would allow the "Users Near This User" option to work for non-US members? If not, could something be developed? (For example, are there unused Zip code numbers that could be designated to major world cities, regions or countries and which would then allow me to see other Canadians who live in my city or at least province?)
posted by Jaybo to Feature Requests at 11:38 PM (45 comments total)

Postal codes might work for Canada. I don't know enough about the postal organisation of the rest of the world to know if that would work as well, or if it's too parochial, and would require a country-by-country design.
posted by Pseudoephedrine at 12:28 AM on December 21, 2005

Latitude and longitude is the obvious choice.

I came up with this SQL statement for something similar:

SELECT id, lat, lon
FROM users
WHERE lat <> 0 AND lon <> 0 AND id <> (queryingid)
AND DEGREES(ACOS(SIN(RADIANS(queryinglat)) * SIN(RADIANS(lat)) + COS(RADIANS(queryinglat)) * COS(RADIANS(lat)) * COS(RADIANS(queryinglon-lon)))) * (ratio) < (distlimit))br>
ratio is 60 * 1.1515 for USian miles. HTH!
posted by moift at 12:29 AM on December 21, 2005

oops post formatting kinda screwed that up. If there's any real interest in a lat/lon I'm reachable by email for details or there are guides online written by people smarter than me.
posted by moift at 12:31 AM on December 21, 2005

also er nevermind the ratio comment that's stupid. overzealous copy/pasting :] *backs slowly out of thread, turns, runs*
posted by moift at 12:37 AM on December 21, 2005

(1.1515 is the conversion from the default nautical miles, 60 is totally unrelated, *continues running*)
posted by moift at 12:38 AM on December 21, 2005

I would enjoy a feature like this as well, especially to know who's here in Brazil, but don't know how it would work. American zip codes cover a pretty large amount of ground/people, versus a Canadian postal code that narrows down your house to a particular street. My CEP number in Brazil is not quite as specific, but close. Lat/long sounds like an okay way to go, but it would be entirely geographical proximity, i.e. I wouldn't necessarily get to see who else is in the rest of Brazil. Maybe instead of unused zip codes it could be some other sort of designation for countries (with the exception of some of the bigger ones, e.g. giving each Canadian province its own.) Dunno, could work. But it'd be work.
posted by wallaby at 1:46 AM on December 21, 2005

Of course this has come up many times before (I'm sure to be missing some).

Apparently mathowie converts zip to long-lat. What isn't clear is where he does the conversion. There are online tools that can be scraped for Canadian data, but I'm not sure where to find a downloadable table.
posted by Chuckles at 2:16 AM on December 21, 2005

And again recently...
posted by Chuckles at 2:19 AM on December 21, 2005

There are about 7 million Canadian Postal Codes possible because the format isn't arbitrary, it is successively smaller geographic (not necessarily population) groupings. (Were it arbitrary, there could be about 17 million.) The final grouping of the local delivery unit (the second three codes) is somewhat arbitrary so it's not the case that Canadian Postal Codes necessarily indicate a specific house, block of houses, or small area. It can indicate an entire small town, for example. Modern Canadian Postal Codes were introduced between 1971 and 1975.

US Zip Codes, in contrast, are also historically geographically derived but are not necessarily so and, in fact, in a good number of cases the codes aren't geographic at all (or they are non-existent). In theory, then, all 100,000 possible 5-digit Zip codes could be used, but there would be mass changes. In reality, the 5-digit codes in their first three digits correspond to geographic areas, while the final two represent logical population areas, primarily, or some other groupings. For large cities, the final two digits of the zip code often are the same two digits that were their city code prior to the adoption of the Zip Code.

Zip+4, with the additional four digits, allows much finer groupings that, also, are in many cases geographical but not necessarily so. Examples of exceptions are post-office box Zip+4 codes. You'll notice that the theoretical limit for the number of Zip+4 codes is one billion codes, which, again, could be possible with a great deal of change that largely abandoned the geographical groupings that exist historically but not necessarily.

Zip Codes were introduced in the US beginning in 1963; the Zip+4 in 1983.
posted by Ethereal Bligh at 2:34 AM on December 21, 2005

I like the frappr solution already in place, it just needs to be prominently linked and put in the profile setup options. Works for the whole world....
posted by Rumple at 3:02 AM on December 21, 2005

How about international calling codes + area codes instead of / in addition to zip codes?
posted by todbot at 3:58 AM on December 21, 2005

I prefer the lat/lon solution - that would make it easier to generate a map.
posted by tcp at 4:29 AM on December 21, 2005

How about international calling codes + area codes

I'd imagine the vagaries of area codes in different countries would make it a bit of a hassle.

Here's a list of UK Postcode area codes matched to longitude and latitude. (It'd have to be area code only if UK postcodes were used, as the full postcode refers to a specific street address - ie. G4 is my bit of Glasgow, G4 [number][letter][letter] is my house, and I'm not sure I want you all to know exactly where I live!)

It's not too hard to find out one's long/lat, though, so I'd say being able to enter that would be best (especially if mathowie is already converting zip codes to long/lat).
posted by jack_mo at 4:36 AM on December 21, 2005

I don't really think the scheme works domestically, either. Or else there needs to be an additional element added for population density, eg, jcterminal 07016 is near 11217?!
posted by ParisParamus at 5:40 AM on December 21, 2005

Chuckles: Yes, this has come up many times before, but this is one of those instances where I'm in favor of people bringing it up repeatedly until Matt does something about it. It's overwhelmingly popular, and it seems like it shouldn't be that hard to do (judging from comments by people who, unlike me, know something about it).
posted by languagehat at 5:52 AM on December 21, 2005

GoogleEarth seems to be able to take a postal code (with no country specified) and find the location in Canada, UK or USA without any trouble. I imagine it would work for other countries too. Maybe there's something in the API that could be hooked into Metafilter?
posted by blue_beetle at 6:19 AM on December 21, 2005

I'll be changing to lat/lon soon.
posted by mathowie (staff) at 6:42 AM on December 21, 2005

I'll be changing to lat/lon soon.

you wore that one out around 2002.
posted by quonsar at 6:58 AM on December 21, 2005

Cartography (incidentally, a really good mapping blog) points to a couple of resources that translate Canadian addresses into lat/long.
posted by mcwetboy at 7:28 AM on December 21, 2005

Jaybo, if you want to find other Canadians, just yell out "Canadians, represent!"

They'll come running.
posted by SassHat at 7:45 AM on December 21, 2005

I've found us Canadains will eventually find each other, but it helps if you put your location in your profile more specific than "Canada". It's a big place, eh? Maybe you could include your province?
posted by raedyn at 7:53 AM on December 21, 2005

This site provides free worldwide placename to long/lat geocoding, with a REST interface. It is very useful.

(There is also the raw data they use, if you want your own huge SQL tables.)

Google Map's API doesn't provide geocoding, unfortunately.
posted by smackfu at 8:24 AM on December 21, 2005

They'll come running.

Yes, but it might take a while for them to get to where you are, eh.

Whereas in my country, you can just use a bullhorn, and you'll have an instant meetup, and some confused Germans with a ringing in their ears.

Seriously, I'm all for this, not in the least because I have resorted to adding nearby Mefites as "neighbours" in my profile just to keep track for a (near-)future meetup.
posted by goodnewsfortheinsane at 8:32 AM on December 21, 2005

No argument with you there languagehat, just think it is worth keeping track of the history (and too tired at the time to do a thorough job).
posted by Chuckles at 8:45 AM on December 21, 2005

I think Fiona will be working on this; she'll have a lot of free time until preschool starts.
posted by timeistight at 10:04 AM on December 21, 2005

Thanks for the tip smackfu. I got the REST interface going right now, and I'm in the process of converting all 30k users with zips to lat/lon (I'm up to 13,000 so far).

If you check out your preferences page, you'll see that lat/lon is now there. I haven't updated the userpage "near this user" lookup yet, but will do that later tonight.

Thanks again timeistight, for writing the code you did during your internship. I modified it to include the REST lookup and am using that to do the conversion. I should be done converting everyone within the hour.
posted by mathowie (staff) at 7:58 PM on December 21, 2005

Ok, cool, but I have forgotten what you (Matt) said it means when we put our zip codes on our (my) user page but it still says no zip found in the db. Is that something that the solutions posted in this thread will address, also?
posted by Lynsey at 8:38 PM on December 21, 2005

Lynsey, your zip wasn't in the 1999 census so I couldn't update you to lat/lon automatically.

But later tonight, I'll be doing lookups based on lat/lon and not zip, so even the "no zip found" folks should have some people near them (esp. people near a major city).
posted by mathowie (staff) at 8:42 PM on December 21, 2005

This is cool. Thanks Matt!
posted by timeistight at 9:05 PM on December 21, 2005

And by the way, while it's true that Google doesn't return longitude/latitude, it does accept them, so if you start with a rough estimate you can iteratively tweak them until you get as accurate as you want to be.
posted by timeistight at 9:11 PM on December 21, 2005

mathowie, the geocoding link on the user preferences page is terrible for Canadian addresses, could you add something like: for Canadian addresses try here.
posted by Chuckles at 10:15 PM on December 21, 2005

Specifically, understands postal codes, doesn't appear to understand anything but city and country.
posted by Chuckles at 10:18 PM on December 21, 2005

Or use the Geocode lookup dealy linked from the Preferences page.

(I'm pretty sure Mapquest used to give out longitude/lattitude, but I can't figure out how now since they changed their interface.)
posted by arto at 10:21 PM on December 21, 2005

Oh yeah, thanks Matt and Timeistight, this is awesome.
posted by arto at 10:25 PM on December 21, 2005

Cool! I presume the lat and long should be in decimal conversion, not minutes and seconds?
posted by wilful at 10:46 PM on December 21, 2005

yep, decimals.
posted by mathowie (staff) at 10:59 PM on December 21, 2005

Since we can no longer make any changes to our profiles w/o removing ahem, improvements, will Matt add a state, province or country?
Frankly, lat and long do not mean much to me and I would prefer to see a political designation.
Also an email address!
posted by Cranberry at 11:37 PM on December 21, 2005

Ok, that worked. Thanks, timeistight and mathowie. But I have another question now. My profile page now says "no other MeFi members nearby, sorry." But I know that there is/are MeFians in Sebastopol (17 miles away) and Santa Rosa (35 miles away) for example. What is the mileage limit? Because on Matt's profile page, it says "12 MetaFilter users near this user:
azlondon 25 miles, cairnish 31 miles, docpops 15 miles, dragstroke 33 miles, hangry 26 miles, karmaville 26 miles, miss meg 24 miles, mrmorgan 26 miles, nathanos 29 miles, peep 30 miles, spudnuts 30 miles, wdpeck 29 miles."
posted by Lynsey at 11:40 PM on December 21, 2005

will Matt add a state, province or country? Frankly, lat and long do not mean much to me and I would prefer to see a political designation. Also an email address!

There is an open-ended location field. And yes, you can make your email address visable to other users if you want.

My profile page now says "no other MeFi members nearby, sorry." But I know that there is/are MeFians in Sebastopol (17 miles away) and Santa Rosa (35 miles away) for example. What is the mileage limit?

It's half a degree of long/lat on the earth's surface. If I remember correctly, I think that's about 25-40 miles in the northern hemisphere (it varies depending on your location up the globe). I have no clue why people nearby aren't showing up in your search, unless you're surrounded by tons of water and no one lives nearby or something.
posted by mathowie (staff) at 1:55 AM on December 22, 2005

W00t! Thanks, Matt!
posted by languagehat at 5:49 AM on December 22, 2005

Awesome Matt. Maybe sort by distance?
posted by smackfu at 7:04 AM on December 22, 2005

(Oh, I just saw the big thread about explicitly that. Nevermind.)
posted by smackfu at 7:09 AM on December 22, 2005

Awesome! Thank you!
posted by raedyn at 7:51 AM on December 22, 2005

"...unless you're surrounded by tons of water and no one lives nearby or something." Heh.
posted by Lynsey at 3:26 PM on December 22, 2005

Thanks Matt! This is like the one present you get to open before Christmas Day (but multiplied by a million.)

Not sure where everybody's following developments but thought I'd reply to a few points in this thread...

- sorry for not checking if the question had been asked before...but look what my laziness got us!

- Raedyn, I only put "Canada" in my profile because I prefer to be stalker rather than stalkee. Just kidding but it's funny that you pointed this out as we're the only two showing up for Regina. (And if you want to do a meet-up, we'll have to do it before Dec 30 as I'm moving to Ontario - I just changed my Lat/Long.)

- this is more of a long-term idea for a tweak but it might be fun to show "birthplace" as well as location, especially if you could show a a different coloured pin or something.

Thanks again Matt!

posted by Jaybo at 2:16 AM on December 23, 2005

« Older That's a lot of self-linking   |   What is's policy on linking... Newer »

You are not logged in, either login or create an account to post comments