Search code examples
google-mapsgoogle-maps-api-3geocodinggoogle-maps-api-2

highlight a list of streets on a map


We have a database of addresses that we deliver to. It consists of the following data;

StreetName
NumberFrom
NumberTo
ZipcodeId (points to seperate table with zipcodes, which holds cityName)
StoreId

Would it be possible to highlight all those addrresses on a map like GoogleMaps (preferred), Bing, OpenStreetMap, etc. ?

I know how to add polylines, and have done geocoding in the past for addresses.

A possible issue with the data, is where it covers whole street they practise have been to just set the NumberTo to 9999. If i plot an address into google Earth with 'StreetName 999, City' it will place the point in the middle of the length of the street.

Also tried a random number, and it placed the marker on a building instead of on the street.

I don't know if it's different for GoogleMaps..

Update

I think that the DirectionsService in GoogleMaps API is the way to go, now i only need to figure out if and how i can use it multiple times on a map.


Solution

  • Success!

    I was able to iterate over all the addresses, doing a DirectionsService request for each addres, from start of street to end of street. Extract the GeoPoints used by DirectionsDisplay, stored it to the database and is now able to draw Polylines on a map for each road.

    I could iterate over the addresseseach time the map is shown (in-house use only). But still this would be a performance issue, and also unsure if how many request Google will handle per day. By storing it in DB i only need Google to calculate it once.