none
Get boundaries demo with full Canadian postal codes. RRS feed

  • Question

  • Hi All,

    I'm playing around with the "Get Multiple Boundaries" demo in: https://www.bing.com/api/maps/sdk/mapcontrol/isdk/sdsloadmultipleboundaries#TS.

    I can't seem to get it to draw boundaries when I enter full Canadian postal codes in the demo (V5A 1W1 for example).

    Switching to the "PostCode2" entity type gets a boundary drawn but looks like it's too wide when compared to other mapping tools.

    Am I missing something?

    Thanks!


    • Edited by RAngeles1 Thursday, October 4, 2018 11:54 PM Fixing title.
    Thursday, October 4, 2018 11:51 PM

Answers

  • Hi RAngeles1,

    Because of how Canadian Postal codes work, that postal code maps to a location not an area boundary.  Try this:

    1, Go to bing maps at bing.com/maps and type that postal code and hit enter

    Answer: It gives you a pin location on a map

    2. Now remove the last three and just search 'v5a'

    Answer: It gives you the region for Burnaby

    However, I don't seems to see the boundary on the call, even cycling through 1-4 Postal codes.

    center: new Microsoft.Maps.Location(49.237150, -122.970184),
        zoom: 10 });
    //Create an array of locations to get the boundaries of 
    var zipCodes = ['v4a','v5a','v5b','v4b'];
    var geoDataRequestOptions = {
        entityType: 'PostalCode2'
    };

    Monday, October 8, 2018 5:30 AM
    Owner

All replies

  • Hi RAngles1,

    How precise a postal code are you supplying? Canadian Postal codes have tight granularity so it really depends what you are looking for.

    Here is an excellent example http://mybronte.ca/canada-postal-code-map/ shows approximately one letter per province/territory.

    If the detail seems too coarse, you can try modifying the line width of the polygon or the LevelOfDetail setting https://msdn.microsoft.com/en-us/library/dn306801.aspx

    Sincerely,

    IoTGirl


    Friday, October 5, 2018 5:11 PM
    Owner
  • I'm providing the 6 character postal code (V5A 1W1 for example).

    I changed this line in the demo code

    var zipCodes = ['98004', '98005', '98007', '98008', '98039'];

    to be

    var zipCodes = ['V5A 1W1'];

    I was expecting the boundary to be something like the one below but no boundary got drawn.

    https://social.msdn.microsoft.com/Forums/getfile/1344655

    I will try modifying the line width like you mentioned and will let you know what happens.

    Thanks!

    Friday, October 5, 2018 9:59 PM
  • Hi RAngeles1,

    Because of how Canadian Postal codes work, that postal code maps to a location not an area boundary.  Try this:

    1, Go to bing maps at bing.com/maps and type that postal code and hit enter

    Answer: It gives you a pin location on a map

    2. Now remove the last three and just search 'v5a'

    Answer: It gives you the region for Burnaby

    However, I don't seems to see the boundary on the call, even cycling through 1-4 Postal codes.

    center: new Microsoft.Maps.Location(49.237150, -122.970184),
        zoom: 10 });
    //Create an array of locations to get the boundaries of 
    var zipCodes = ['v4a','v5a','v5b','v4b'];
    var geoDataRequestOptions = {
        entityType: 'PostalCode2'
    };

    Monday, October 8, 2018 5:30 AM
    Owner
  • Hi RAngeles1,

    I have confirmed with the back end team that the three first characters of a Canadian Postal code will draw polygons using Postalcode2.

    Sincerely,

    IoTGirl

    Thursday, October 11, 2018 6:19 PM
    Owner
  • Thanks for the info loTGirl!

    FYI, the code snippet you sent works for me. Not sure why you don't see the boundaries.

    Last thing to note is that I had to add

    getAllPolygons: true

    to the geoDataRequestOptions object since some boundaries don't draw when that option is disabled (V3S postal code is an example).

    Hope this helps someone down the road.

    Thanks again!

    Thursday, October 11, 2018 9:40 PM
  • You are very welcome!

    PS I am from Vancouver so familiar with those area codes :)

    Friday, October 12, 2018 4:36 AM
    Owner
  • Lol I'm from Vancouver too!
    Monday, October 15, 2018 5:51 PM
  • HA! Can I guess Burnaby (v5A-1W1 for example)?  I suppose you figured out my Zip was White Rock!
    Monday, October 15, 2018 8:00 PM
    Owner