Closed togakangaroo closed 12 years ago
Yeah, I'm going to geocode all of the clinic addresses and add them to the JSON. From that point new addresses will be geocoded as they're added. I mentioned this in #3 so I'm going to close this issue (duplicate.)
Actually it makes more sense to keep this as a separate issue since you can't proceed on #3 until I finish this (in other issue tracking systems we could link the two issues as related or depends-upon.) Reopening.
@togakangaroo The lat/lngs are now in the JSON as 'lat' and 'lng.'
George, couldn't we just hard code this data after fetching it the once? Then leave it as a thing that Lindsey can change when (and if) she ever has to change a clinic's address? Because of all the data, it strikes me that location would be the least in need of being dynamic. Just a thought.
~Robert
Yeah, it's hardcoded in the JSON now. When I hook up the backend Lindsay will be able to add/update clinics and the app will fetch the lat/lng at that time and update the database (which will produce the JSON.)
@togakangaroo be warned that there are two clinics (mobile ones) that didn't geocode. They have 0.0 for both lat and lng.
Ok, so I was all set to flip the switch on the distances yesterday when I realized that in order to sort by distance we need the geocoded location of every clinic before we can even call into the distance Matrix.
However, you can only geocode one address at a time. As far as I can tell no service allows you to geocode multiple addresses at one time for free. And you can't issue parallel queries or you get OVER_QUERY_LIMIT back. The guidance is 200ms in between meaning at least 12 seconds to geocode all the clinics. If we want to allow for multiple users at a time then we have to double or triple that number. Even if we use localstorage this is still happening once-per-user.
So the solution as always with scaling problems is to shift read-time to write-time. Meaning that, when they do the initial data import, the ruby code needs to call the google maps api, geocode each address, and serve it as part of the json.
Rob, can you do this? If not, I'm going to be on the phone with some ruby guys this Thursday and they can hopefully help.
PS To get full address c.Street+" "+c.City+" "+c.State+" "c['Zip Code'] seems to be working fine