Answered Is there any way to get the MBR for a given street?

  • Wednesday, April 25, 2012 4:35 AM
     
     

    I have a requirement to be able to determine the MBR (minimal bounding rectangle) of a given street (city and state are known). Is there a way to get that from any of the Bing Maps services? (I tried geocoding the address without the house number using the REST service, and got back a point somewhere along the street. The response structure did include something called "BoundingBox", but it definitely was not what I am looking for)

    I asked this question couple years ago, and at that time the best answer I got was along the lines of:

    - Do a forward geocode for the address without house number
    - Do a reverse geocode for the coordinates from the previous step, get the full address
    - Do a series of forward geocodes for addresses up and down the street until the street is exhausted in both directions
    - Calculate the street MBR from the coordinates gathered in the previous step

    The above algorithm looks like it would eventually produce the results I am looking for, but is horribly inefficient, and would take quite a bit of "wall clock" time, especially for longer streets (being able to produce result in single-digit-seconds is highly desirable for my application). If there's no direct way to get what I need, may be I can get some information that would allow me to optimize the number of requests the "walking" part of the code has to do? Even having just the numbers of the first and last houses on the street would help a lot, for example.

All Replies

  • Wednesday, April 25, 2012 7:06 AM
    Moderator
     
     Answered

    Hi there,

    None of the Bing Maps services are really designed to answer this question and, depending on exactly what you're doing with the MBR, it might be against the Terms of Use anyway.

    Is using Open Street Map (http://www.osm.org) an option? They don't provide a service that returns MBRs for a street address but, if you host the OSM data yourself in a spatial database such as SQL Server, you can easily compute the MBR of every road using the STEnvelope() method.


    twitter: @alastaira blog: http://alastaira.wordpress.com/

  • Monday, April 30, 2012 8:05 AM
     
     

    Hi there,

    None of the Bing Maps services are really designed to answer this question and, depending on exactly what you're doing with the MBR, it might be against the Terms of Use anyway.

    Is using Open Street Map (http://www.osm.org) an option? They don't provide a service that returns MBRs for a street address but, if you host the OSM data yourself in a spatial database such as SQL Server, you can easily compute the MBR of every road using the STEnvelope() method.


    twitter: @alastaira blog: http://alastaira.wordpress.com/

    Is OSM an option?.. It's a good question. Without boring you to death with the details of our system, the answer is "most likely no". We are trying to get away from hosting map data internally (having to keep updating the data is painful), and for us it is very important that map display and geocoding parts of the system use the exact same dataset (if map UI is using BingMaps, and the backend geocoder works with OSM, we will inevitably get into situations where users and the geocoder will see different coordinates for the same street (been there, done that), which in our domain leads to expensive issues)

    Thanks for the idea anyway. :)