As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

Understanding Canadian Postal Codes

RamiusRamius Joined: July 19, 2000Administrator, ClubPA admin
edited November 2011 in Help / Advice Forum
OK, so I've found plenty of technical descriptions of the Canadian Postal system, but nothing that answers my question in direct, layman terms. I suspect I understand it correctly, but hopefully some Canucks here can verify for me.

I'm creating a web-service that matches up an individual with their "Local Sales Representative". Currently there are only a couple dozen Sales Representatives for all of Canada, but there is nothing saying that there couldn't be hundreds in the future.

So, a Canadian person goes to the web-form and fills in their Postal Code, and then my program looks up that Postal Code in a database and returns the assigned sales rep. Somebody (not me) gets the thrilling job of maintaining a datafile that maps sales reps to postal codes. What I'm trying to figure out is whether I can prevent making that data-entry person's life horrible.

There are about 850,000 Postal Codes in Canada. However, there are only about 1,800 FSA's (forward sortation area = the first three characters in the postal code). Should it be safe to create the datafile mapping using only the FSA? Assuming I don't expect to be drawing any arbitrary lines right down the middle of the map, thus splitting a town or village in two, I'm thinking the FSA is a reasonable-sized geographic area for dividing up the population...yes?

Ramius on

Posts

  • IcyLiquidIcyLiquid Two Steaks Montreal, QuebecAdministrator, Vanilla Staff vanilla
    I have no idea how it actually works, but I'm pretty sure they just figured out the easiest way to train the dogsled teams to find the houses and this was it.

  • DeusfauxDeusfaux Registered User regular
    edited November 2011
    There HAS to be numerous well developed systems and frameworks in place that already do what you're asking for.

    Any kind of organization or business with multiple location has a location search function that works with input of a postal code, and there's no way they all wrote their own programming from scratch.

    I'd suggest finding out how to get this stuff pre-baked, so you just plug in YOUR company's data.



    But to answer your question, try looking at postal code maps. You'll see how large an area the FSA covers geographically.

    Deusfaux on
  • Gilbert0Gilbert0 North of SeattleRegistered User regular
    Yes that's exactly right, don't try to manage 850,000 things, manage the 1800.

    Even locally (Edmonton) there are 30+ (about haven't counted recently) and when dispatching crews in the city, there are rules for the North ones to use these 7, South use these 9, Floater use these 3 FSA's. It's not perfect because whenever you are on an edge one could be closer than the other but we just kind of ignore that.

    For your use, when there is a rep per city or so, that should work great for you (until you start getting 3+ people per city).

  • Gilbert0Gilbert0 North of SeattleRegistered User regular
    Deusfaux wrote:
    There HAS to be numerous well developed systems and frameworks in place that already do what you're asking for.

    Any kind of organization or business with multiple location has a location search function that works with input of a postal code, and there's no way they all wrote their own programming from scratch.

    I'd suggest finding out how to get this stuff pre-baked, so you just plug in YOUR company's data.


    But to answer your question, try looking at postal code maps. You'll see how large an area the FSA covers geographically.

    There are, but you'd be surprised how expensive some of that stuff is. Though with what I deal with, we need a 24x7 always up type solution so there might be some free alternatives out there more for you.

  • FoomyFoomy Registered User regular
    edited November 2011
    the first letter in the fsa part of the postal code designates province or teritory or a section thereof for Ontario/Quebec, second denotes rural or urban area, and the third the local area of an urban location.

    so you should be just fine mapping the fsa's to sales reps unless your dealing with a lot of rural areas. for rural/small towns you need the whole postal code to tell where the place is beyond a province.

    edit: wikipedia has nice lists of the postal codes and links to the canada post maps of the fsa's.:
    http://en.wikipedia.org/wiki/List_of_A_postal_codes_of_Canada

    Foomy on
    Steam Profile: FoomyFooms
  • WezoinWezoin Registered User regular
    I don't know if this helps at all, but is there any way you can get your program to look it up on Canada Post's website and use it from there?

    They have a tool that lets you type in a postal code and gives you the address. I believe google maps also lets you search by postal code and can return an address so that is also an option if you can somehow get your program to output the postal code to the website and then accept the address it returns.

  • ilmmadilmmad Registered User regular
    Wezoin wrote:
    I don't know if this helps at all, but is there any way you can get your program to look it up on Canada Post's website and use it from there?

    They have a tool that lets you type in a postal code and gives you the address. I believe google maps also lets you search by postal code and can return an address so that is also an option if you can somehow get your program to output the postal code to the website and then accept the address it returns.

    It's generally a bad idea to simply submit information to an external webpage and then parse out what you want from what the website returns. Building an application to depend on a website out of your control is asking for trouble, because it means your application will break if the website you depend on changes.

    Instead what he wants is an API, or application programming interface. APIs allow you to use certain functionality of a website in a better way than what I described above - by making requests to the API, a programmer receives the data they want.

    Ramius, in this case you should look into the family of Google Maps APIs, specifically the Geocoding API. Note that this is restricted to 2,500 requests per day, unless you pay for a premier account. Also, you must display the data using Google Maps. If this is too restrictive, look into geocoder.ca. I'm sure there are more similar APIs available.

    Such an API will allow you to convert a postal code to a format that is easier to map to a representative.

    Ilmmad.gif
Sign In or Register to comment.