Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As far as I know, none of the common web map APIs offer this facility. Two possible approaches come to mind, although neither one is straightforward or reliable:</p> <p>a.) Download from OpenStreetMap a local set of all the road data that you want to be able to highlight in your application. Then, when your user enters the street name they are searching for, search the OSM data and construct a polyline from the relevant coordinate points and plot it on the map. The problem with this approach is that it requires you to host and maintain a complete set of road data, and also implement the appropriate parsing algorithm to deal with misspellings of street names etc. You may often find that road names as they appear on Google Maps will be spelled differently than they are in OSM, for example.</p> <p>b.) Use a routing service to calculate a route from one end of the street to the other, and then plot a polyline that follows the points of the route. e.g. Using the Bing Maps Routes API (<a href="http://msdn.microsoft.com/en-us/library/ff701717.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ff701717.aspx</a>), you could plot a route between the two intersections at either end of the road in question - e.g. "Av. Montaigne &amp; Rond-point des Champs-Élysées" to "Av. Montaigne &amp; Place de L'Alma". You could then plot a polyline from the route points as follows:</p> <p><img src="https://i.stack.imgur.com/QFrnH.png" alt="Highlight street in Bing Maps"></p> <p>There are two problems with this approach: first, you need to know the names of the roads with which the street intersects at either end (or some other way of identifying the ends of the street in question), and secondly, the route chosen between those two intersections may not actually follow the street itself (for example, if the street is one-way and you try to calculate a route in the other direction). </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload