Searching for postal code

While mapping all houses in my little home town, I tried a few “queries” in the openstreetmap.org web site. Searching for a particular street name lets the site zoom in on that street as expected. Searching for a postal code however zooms out and only shows a link on the left. Hovering over that link shows a marker on the map where the postal code is located:

image

It doesn’t zoom in, and clicking the link doesn’t help. When you manually zoom in, the marker disappears (as it is only shown when hovering over the search result), so you have to zoom in a bit, hover again, zoom in some more, etc. After zooming in, when you click the search result link, it zooms out again like the first pic.

Is this expected behavior? It feels like I am missing something. It would be great if it worked like how it zooms in on a street name, or how other online maps are able to show the postal code area.

Regards, Niek.

Maybe this posting might help:

I understand that postcodes in your place identify a very small area within a township, like a single road or a block of buildings (which is very much different from postcodes in my place). As far as I can see the postcode itself is not tagged to a clearly defined area, it is just a feature of the buildings located in such a place. This is probably the reason why the precise area of the postcode cannot be shown on the map.

Nevertheless the Nominatim search places the marker exactly in the area where the buildings with this postcode are located and this is more than I would have expected. The only feature missing is the “zoom in” to this area. I don’t know if this expected behaviour but I would not bother about it. It just takes a quick and simple action with the mouse and there you are … :grinning:

Edit: When you search for a postcode in my place, you will first see a similar result as in your case (the red marker is not visible in this screenshot):

then clicking the search result will show you the complete area (red boundary):

I think this is what you are expecting but that requires the postal code area to be mapped with a precise border, which is not the case in your place.

Yup, that actually is perfectly expected behaviour.

First I think you’ve got to understand what that search you’re doing is actually looking for and returning back to you. The search bar on openstreetmap.org uses an OSM-specific search engine called Nominatim, and all it’s really looking through is “raw” data that has been entered on OSM. Think of the openstreetmap.org website not so much as a map, but a user interface to see data that has been entered into a database. When you search for, for example, “McRae Street, Okotoks” Nominatim just spits out the line segments that happen to have “McRae Street” entered into a “name” data point associated with them. It’s not giving you “McRae Street” in its entirety.

So, similarly, when you look for the postal code “T1S 1J5” Nominatim just extrapolates a centre point that averages the position of everything in the database that happens to have the “addr:postalcode=T1S 1J5” data point entered into it. Nominatim can highlight road segments with the name “McRae Street”; unfortunately it can’t highlight every house in the database with the T1S 1J5 postal code.

When you go looking at other online maps that can seemingly highlight where the postal code “is”, those maps are just extrapolating an “area” over which the postal code applies. However, that’s not how it’s actually defined by Canada Post. Canada Post has a (proprietary) database of postal codes and associated addresses, and vice versa, but it’s not really something that is geographically defined. For example you can extrapolate that T1S 1J5 is geographically associated with McRae Street east of Poplar Avenue, in the town of Okotoks, Alberta, but Canada Post just randomly assigned it that way. There’s nothing stopping that code from being reassigned somewhere else, and it’s not really entirely consistent either: there’s a house further north on Poplar Avenue with the T1S 1J5 postal code too, but there’s a townhouse development between that has an entirely different postal code, T1S 1Z5. Similarly the apartment building at the southeast corner of McRae and Poplar has its own unique postal code, T1S 2H4; literally no other building in the country uses that postal code.

As such, because the postal codes are only tangentially related to the addresses of buildings, there aren’t specific boundaries in the OSM database that define where one postal code ends and another begins, and the functionality you’d like Nominatim to have just isn’t there.

Now, you might argue “well why don’t we just map those boundaries in OSM?” I for one personally don’t think it’s a good idea because:

  • the aforementioned fact that they’re not technically defined by their geographic location,
  • there are many parcels of land that don’t have an associated postal code, so technically a “postal code map” if done “correctly” will have lots of gaps and discontinuities that overzealous people are going to try to erroneously extrapolate,
  • conversely there are many postal codes which don’t have an associated physical location, i.e. P.O. boxes
  • big buildings (think skyscrapers in Downtown Calgary) sometimes have multiple, overlapping postal codes
1 Like