Ah! Ok. I'll just re-use that fn. Stand by.


On Mon, Oct 21, 2013 at 11:24 AM, Prashant Singh
<notifications@github.com>wrote:

> In src/js/api.js:
>
> > @@ -229,17 +229,24 @@ define(function (require) {
> >    // Add "Detroit" to the end.
> >    // Return the first result as a lat-lng for convenience.
> >    // Or Null if Bing is being a jerk / we're dumb.
> > -  api.codeAddress = function(address, callback) {
> > -    console.log("Coding an address");
> > -    console.log(address);
> > -    var detroitAddress = address + " Detroit, MI"; // for ease of geocoding
> > -    var geocodeEndpoint = "http://dev.virtualearth.net/REST/v1/Locations/" + detroitAddress + "?o=json&key=" + settings.bing_key + "&jsonp=?";
> > +  /**
> > +   * Geocode an address
> > +   * @param  {String}   address  eg "123 foo street"
> > +   * @param  {String}   region   A region to narrow the search. eg "Detroit"
> > +   * @param  {Function} callback Takes params in the format error, [latlng]
> > +   */
> > +  api.codeAddress = function(address, region, callback) {
> > +    address = address + " " + region; // for ease of geocoding
>
> I meant, could we detect an input like 2160 Market St, San Francisco, CAand avoid adding another San
> Francisco, CA to the end? The implementation in mobile is naive (I think
> it just looks for commas) but helps a little. That also allows people to
> search outside of the survey location, in case multiple municipalities are
> involved or when we let folks browse through shared data.
>
> I've seen people type in the entire address (number + street + city +
> state) on mobile, which is partly what motivated that code.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/LocalData/localdata-dashboard/pull/178/files#r7102861>
> .
>



-- 
Matt Hampel
LocalData <http://localdata.com>
(734) 846-5010
team: info@localdata.com