Author Topic: Google maps: driving heat map?  (Read 165 times)

0 Members and 1 Guest are viewing this topic.

Offline darthekai

  • rivaling ZZ-TOP
  • ****
  • Posts: 3308
  • I CANT STOP POOPING
    • My Webpage
  • Location: Calgary, AB
  • Ride: 2000 OBS EJ222 +MFT, KTM Duke 390, 1996 Ford E350 SD ambulance
Google maps: driving heat map?
« on: January 03, 2019, 02:42:03 PM »
Does anyone here know either a) the google maps API decently well or b) of an existing service that does this?
I think it would be really cool if I could choose a place on google maps and have the driving directions results for driving time for different cities out from that point generate contours or a heat map. i.e. I'd like to be able to drop a pin in calgary and see how far 1h of driving would take me in any direction, 2h, 3h, etc.

To do it I think you would need to query directions to any population centers within, say, 500km...extract time traveled, then use extrapolation to draw contours based on straight line distance from target.
What man put together, man can rend asunder and then also put it together sometimes what's all this left over stuff
Subaru Ford

Offline seat safety switch

  • rivaling ZZ-TOP
  • ****
  • Posts: 5859
  • Snowmen with fezzes are ardent rally fans.
    • seat safety switch
  • Location: Calgary
  • Ride: 05 Saab 9-2X Linear
Re: Google maps: driving heat map?
« Reply #1 on: January 11, 2019, 10:51:47 AM »
If you were just doing it based on major landmarks, this isn't too bad of a job with the google maps API.

Not sure how good of a contour you are going to be able to get in Alberta, since we don't have that many major urban centres outside of the north-south corridors. You might also run into the rate limit if you pick too many sampling points (especially since you'd be repolling hour-to-hour in order to get semi-realtime info).

You could definitely build it on the cheap for just "your use," but turning it into a site or otherwise publicizing it will definitely hit rate limits, at which point the job gets harder.

I would probably build this with some kind of scheduled job, keep repolling until I hit the rate limit, and then store the distances in a database between sessions, which means the drive-time data might not be particularly fresh but if you had enough of it you could maybe do statistical analysis and figure it out. Giving money to Google probably makes this process way easier.

Graphic-wise:
Google Maps has some kind of innate hatred of the concept of a contour map, so you don't get nice and easy APIs for it. There's some decent "open" algorithms around.

I think there is a heat map API so at least you would not have to write your own rendering code, but Google has an irritating habit of making the API work for their use cases only and suck everywhere else.